Jump to content

[SOLVED] IE7 not working body onLoad to a javascript function


solarisuser

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.