Getting this code to work on netscape 4, and netscape 6+
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jason_Zinn
Posted On:   Tuesday, April 15, 2003 08:36 AM

I can't get this code to work on either of the major netscape versions. It won't hide the menu's at all since I added in the delay. I know the code isn't very effectively written, but I came up with it in a hurry: document.onmouseover = delay_hide; ns4 = (document.layers)? true:false ie4 = (document.all)? true:false ns6 = (document.getElementById)? true:false function init() { if (ie4) { document.all('schedules').style.visibility = "hidden"; document.all('schedules').style.left = "167px"; document.all('schedules').style.top = "151px"; document.all('speakers').style.visibility = "hidden"; document.all('speakers').style.left = "167px"; document.all('speakers').style.top = "174px"; document.all('candidates').style.vi   More>>

I can't get this code to work on either of the major netscape versions. It won't hide the menu's at all since I added in the delay. I know the code isn't very effectively written, but I came up with it in a hurry:




   <<Less

Re: Getting this code to work on netscape 4, and netscape 6+

Posted By:   Nitesh_Naveen  
Posted On:   Wednesday, April 16, 2003 03:20 AM

To start with your checking for ns6 will be true for IE5.5+ also. so for IE higher version kinda both will be executed whcih will be a waste of processor time!!!could be better to check like...
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ns6 = (document.getElementById && !ie4)? true:false

Also you could modify your show_menu as:

function show_menu(item) {
hide_all();
if (ie4)
document.all[item].style.visibility = "visible";
else if (ns4)
document.layers[item].visibility = "show";
else
document.getElementById(item).style.visibility = "visible";
}
(note the usage of document.all - this should be how you use it) This should work fine in Netscape also (provided you have set the position as relative/absolute for teh div in case of Netscape 4x versions)

The function delay_hide will give an error in Netscape 4x since window.event is not defined. you should probably check for the ie4 flag also in that function
About | Sitemap | Contact