solarisuser Posted May 17, 2007 Share Posted May 17, 2007 IE6 and FF2 work fine, but IE7 doesn't like this, and I can't seem to figure out why...any ideas? In HTML file... <script src="coll_items.js" type="text/javascript"></script> <body onLoad=shoh('first');> In coll_items.js... imgout=new Image(9,9); imgin=new Image(9,9); imgout.src="arrow.gif"; imgin.src="arrow2.gif"; //this switches expand collapse icons function filter(imagename,objectsrc){ if (document.images){ document.images[imagename].src=eval(objectsrc+".src"); } } //show OR hide funtion depends on if element is shown or hidden function shoh(id) { if (document.getElementById) { // DOM3 = IE5, NS6 if (document.getElementById(id).style.display == "none"){ document.getElementById(id).style.display = 'block'; filter(("img"+id),'imgin'); document.cookie = "remember_" + id + "=yes"; } else { filter(("img"+id),'imgout'); document.getElementById(id).style.display = 'none'; document.cookie = "remember_" + id + "=no"; } } else { if (document.layers) { if (document.id.display == "none"){ document.id.display = 'block'; filter(("img"+id),'imgin'); document.cookie = "remember_" + id + "=yes"; } else { filter(("img"+id),'imgout'); document.id.display = 'none'; document.cookie = "remember_" + id + "=no"; } } else { if (document.all.id.style.visibility == "none"){ document.all.id.style.display = 'block'; document.cookie = "remember_" + id + "=yes"; } else { filter(("img"+id),'imgout'); document.all.id.style.display = 'none'; document.cookie = "remember_" + id + "=no"; } } } } Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/51758-solved-ie7-not-working-body-onload-to-a-javascript-function/ Share on other sites More sharing options...
mainewoods Posted May 17, 2007 Share Posted May 17, 2007 <body onLoad=shoh('first');> add some double quotes, make onLoad all lowercase: <body onload="shoh('first');"> Link to comment https://forums.phpfreaks.com/topic/51758-solved-ie7-not-working-body-onload-to-a-javascript-function/#findComment-255059 Share on other sites More sharing options...
solarisuser Posted May 17, 2007 Author Share Posted May 17, 2007 Thanks but that did not help. It works great in FF2 but not in IE6 AND IE7 (I said IE7 only last time).Are there any dev tools that might help me track it down? I'm at a total loss =( Link to comment https://forums.phpfreaks.com/topic/51758-solved-ie7-not-working-body-onload-to-a-javascript-function/#findComment-255098 Share on other sites More sharing options...
xenophobia Posted May 17, 2007 Share Posted May 17, 2007 It might not be the onload problems. You can debug your code and see. Let your 'shoh' function be this: function shoh(id) { alert(id); } So if the alert comes out, means that your calling will not be a problems. Link to comment https://forums.phpfreaks.com/topic/51758-solved-ie7-not-working-body-onload-to-a-javascript-function/#findComment-255318 Share on other sites More sharing options...
solarisuser Posted May 17, 2007 Author Share Posted May 17, 2007 Thanks - you were right. Using alert, I managed to track it down by removing every few lines of the page until removing some lines fixed it, and dug deeper until I found it. It turned out to be a third-party JS causing the problem.... thanks! Link to comment https://forums.phpfreaks.com/topic/51758-solved-ie7-not-working-body-onload-to-a-javascript-function/#findComment-255651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.