wrong, you don't use it like that, it is either...
document.getElementById
or
document.getElementByName
or
document.getElementByNameTag
or
document.getElementByClass
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.
We all have baggage to carry in life, unfortunately for me I always get the trolley with the wonky wheel...
Code:
Youre = {
STILL_not_getting_it:function(){
alert("YOU, the original poster / thread starter NEED to POST the code and NOT a LINK.");
},
MissingThePoint:function(msg){
alert("You're missing the point. " + msg);
}
}
Youre.STILL_not_getting_it();
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...
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
Code:
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.
We all have baggage to carry in life, unfortunately for me I always get the trolley with the wonky wheel...
Code:
Youre = {
STILL_not_getting_it:function(){
alert("YOU, the original poster / thread starter NEED to POST the code and NOT a LINK.");
},
MissingThePoint:function(msg){
alert("You're missing the point. " + msg);
}
}
Youre.STILL_not_getting_it();
Bookmarks