Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: need urgent help on a small script!!!

  1. #16
    Join Date
    Jan 2009
    wrong, you don't use it like that, it is either...








    where the "Class" one you need to provide an empty CSS element that you use as a marker in the page.

    and with that, I am going to spend the next several hours examining the inside of my eyelids.

  2. #17
    Join Date
    Dec 2011
    well mozilla developer network said it should be like that

    ok man gnite say hi to ur eyelids

  3. #18
    Join Date
    Jan 2009
    Ok, back on with this...

    If you use any of the methods to access the DOM Tree data, all returns will have properties that you can access that relate to the object type you have returned in the function.

    img = document.getElementsByName("thisElement"); will grab all the elements on the form with a name tag name="thisElement" set. eg...
    HTML Code:
    <img name="thisElement" alt="An Image" src="1.jpg" >
    So between getElementsByName and getElementsByClass, I would use the getElementsByName and set up the name in all the elements you want to access or manipulate.

    Then you access the properties from results of that function.

    So in the case of an image object, all you would do is grab the element, access the properties and make amendments as needed and move on to the next element. The code below roughly summerises the function that gets Data by finding the actual elements you want
    function getTheData( str ){
      results = [];
      x = document.getElementByName(str);
      for(res=0; res<x.length; res++){
        // do we have a match
        if( x[res].name == str){
          results.push( x[res] ); // store the object
    return (!x || x.length==0)? false : x; // now return the results or a control
    so when you call getTheData('resizing'); on your page, assuming that the HTML has neeb sorted out, would return all elements in the DOM tree with a tag element that has a name of 'resizing'.

    You then iterate the returned results array and access each objects properties and amend as needed.

    Like I pointed out previously, UNLESS your HTML output us fully functioning, no matter what you try script wise, the results could be unpredictable or not return anything or the data may be useless. So you need to have your HTML validated to ensure you have no errors. When the HTML is properly generated, you then concentrate on the JAvaScript side of things.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles