|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
To correct the error change: SetVisibility to SetVisible (the function name)
Also change in the function body: obj.visibility to obj.style.visibility Should work now, but hit me back just to check anyways. ![]() |
|
#17
|
|||
|
|||
|
Thanks
its all working now. So now it will work in most browsers right? |
|
#18
|
||||
|
||||
|
Definitely!
![]() enjoy. |
|
#19
|
|||
|
|||
|
Just wondering... what exactly does the below script do?
<script type="text/javascript" language="javascript"> function SetVisible(elementID, visible) { var obj = null; if(document.getElementById) obj = document.getElementById(elementID); else if(document.all) obj = document.all[elementID]; if(obj != null) { if(visible == null) visible = true; obj.style.visibility = (visible ? 'visible' : 'hidden'); } } </script> |
|
#20
|
||||
|
||||
|
>> Just wondering... what exactly does the below script do?
Explanation: 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 BTW: getElementById This is the method being used by almost all the browsers nowadays according to the W3C specs. (including IE's newest versions) document.all Internet Explorer's way of addressing objects. Hope this clarified you. Last edited by #ShAm4n : February 9th, 2004 at 01:34 PM. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > css rollover |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|