Forum Moderators: open

Message Too Old, No Replies

Javascript: IE vs FF

Script Works in IE, not in FF

         

jrivesj

7:38 pm on Dec 3, 2005 (gmt 0)

10+ Year Member



Here's my code, both the JavaScript and the HTML - the "onmouseover" events work perfectly in IE. In FF I get nothing.

******************

<script type="text/javascript" language="JavaScript">
<!--
function show(object) { if (document.layers && document.layers[object]!= null) document.layers[object].visibility = 'visible'; else if (document.all) document.all[object].style.visibility = 'visible'; }
function hide(object) { if (document.layers && document.layers[object]!= null) document.layers[object].visibility = 'hidden'; else if (document.all) document.all[object].style.visibility = 'hidden'; }
//-->
</SCRIPT>

***********

Your help will be greatly appreciated.

THANKS,

Jim

[edited by: DrDoc at 8:57 pm (utc) on Dec. 4, 2005]
[edit reason] examplified and shortened [/edit]

DrDoc

8:55 pm on Dec 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to use getElementById ...
What you should do is something like:

if(document.getElementById) document.getElementById(object).style.visibility = 'visible';
else if(document.all) document.all[object].style.visibility = 'visible';

You can really scrap the document.layers stuff, since that only pertains to NN4 and lower.