Help... No one seems to be able to and answer this one, so I found another script and editted it a little.
Modified Code:
Original Code:Code:var state = 'none'; var class = 'IE-CONTENT-CLOSED'; function showhide(layer_ref, layer_header) { if (state == 'block') { state = 'none'; class = 'IE-CONTENT-CLOSED'; } else { state = 'block'; class = 'IE-CONTENT-OPEN'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.display = state"); eval( "document.all." + layer_header + ".className = class"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].display = state; document.layers[layer_header].className = class; } if (document.getElementById &&!document.all) { hza = document.getElementById(layer_ref); hya = document.getElementById(layer_header); hza.style.display = state; hya.className = class; } }
Calling the function:Code:var state = 'none'; function showhide(layer_ref) { if (state == 'block') { state = 'none'; } else { state = 'block'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.display = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].display = state; } if (document.getElementById &&!document.all) { hza = document.getElementById(layer_ref); hza.style.display = state; } }
With Modification:
WIthout Modification:Code:<img src="images/shim.gif" width="25" height="17" border="0" onClick="showhide('Main','Main_Header');">
<img src="images/shim.gif" width="25" height="17" border="0"HTML Code:Code:onClick="showhide('Main');">
I'm getting Object required errors on the modified version, but I need to change the class of the header so it tells people that its closed or open.Code:<table width="580" border="0" align="center" cellpadding="0" cellspacing="0" class="IE-TABLEGENERIC"> <tr> <td class="IE-CONTENT-OPEN" id="Main_Header"><table width="560" border="0" align="right" cellpadding="0" cellspacing="0" class="IE-TABLEGENERIC"> <tr> <td><img src="images/shim.gif" alt="shim" width="5" height="5" /></td> <td width="5"><img src="images/shim.gif" alt="shim" width="5" height="5" /></td> <td width="25"><img src="images/shim.gif" alt="shim" width="5" height="5" /></td> </tr> <tr> <td width="560"><strong>Test</strong></td> <td> </td> <td><a href="#"><img src="images/shim.gif" width="25" height="17" border="0" onClick="showhide('Main','Main_Header');"></a></td> </tr> </table></td> </tr> </table> <table width="580" border="0" align="center" cellpadding="0" cellspacing="0" class="IE-TABLEGENERIC" id="Main"> <tr> <td class="IE-CONTENT-BG"><table width="550" border="0" align="center" cellpadding="0" cellspacing="0" class="IE-TABLEGENERIC"> <tr> <td>test</td> </tr> </table> </td> </tr> </table> <table width="580" border="0" align="center" cellpadding="0" cellspacing="0" class="IE-TABLEGENERIC"> <tr> <td><img src="images/infobox_btm.jpg" alt="Content Bottom" width="580" height="10"></td> </tr> </table>
Error :
Line: 86
Char: 1
Error: Object expected
Code: 0
URL: http://www.eycdwebdesign.co.uk/v2/
You can view the site at:
http://www.eycdwebdesign.co.uk/v2/
Can anyone help?







Bookmarks