February 9th, 2004, 01:32 PM
Join Date: Feb 2004
Location: 0ffice[c0mput3r] || (Uni())
Time spent in forums: 8 h 50 m 8 sec
Reputation Power: 10
>> Just wondering... what exactly does the below script do?
function SetVisible(elementID, visible)
var obj = null; // initialize var obj, in case none of the object detection methods succeed
if(document.getElementById) // is getElementById method supported by this browser?
obj = document.getElementById(elementID); // it is, try to retrieve element's object
else if(document.all) // is document.all supported by this browser?
obj = document.all[elementID]; // it is, try to retrieve element's object
if(obj != null) // was the object retrieved?
if(visible == null) // it was; was variable visible defined a value?
visible = true; // no, assume user wants to make element visible
obj.style.visibility = (visible ? 'visible' : 'hidden'); // set new element's visibility property
} // end_ if
} // end_function_body
This is the method being used by almost all the browsers nowadays according to the W3C specs
. (including IE's newest versions)
Internet Explorer's way of addressing objects.
Hope this clarified you.
Last edited by #ShAm4n : February 9th, 2004 at 01:34 PM.