Jump to content

<body onload=...> disabling another script?


e1ean0rrigby1
 Share

Recommended Posts

Hi,I have a page which uses 2 javascripts. (slideshow page) One makes the drop-down menus work in IE, and the other creates a slideshow. Other pages use just the drop-down menu script and plain <body> tag (like this page), and it works well on all browsers, including IE. However, when I add the slideshow javascript (and specifically a property to the body tag to make the slideshow work ("<body onload='showHot=true;'>")), the drop-down menus no longer work in IE. Is there something I should be adding to the body tag to make the drop-down menu script work? I would appreciate any tips or advice.Thanks,Eleanor---------------------This is the header and beginning of the body for the slideshow page. (The menus don't drop down in IE.):

<head>		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">		<meta name="generator" content="Adobe GoLive">		<meta name="description" content="Senior Living dedicated to Better Living through Health and Wellness, Life Long Learning and Active Life. It's our commitment to keeping you physically well, mentally stimulated and socially engaged."/>		<title>Spring Hill Senior Living: Experience Better Living in our Independent Living, Assisted Living, and Memory Care Senior Communities. </title>		<!--HEAD stuff-->		<?php include("../../../../sh_includes/head_css.php");?>	<!--SLIDESHOW SCRIPT  (this is not used on other pages) -->		<script type="text/javascript"><!--//--><![CDATA[//><!--//--><!]]>// © 2003 by CodeLifter.com// Free for all users, but leave in this header.// ==============================// Set the following variables...// ==============================// Set the slideshow speed (in milliseconds)var SlideShowSpeed = 3000;// Set the duration of crossfade (in seconds)var CrossFadeDuration = 2;var Picture = new Array(); // don't change thisvar Caption = new Array(); // don't change thisvar showHot = false;       // don't change this// Specify the image files...// To add more images, just continue// the pattern, adding to the array below.// To use fewer images, remove lines// starting at the end of the Picture array.// Caution: The number of Pictures *must*// equal the number of Captions!Picture[1]  = 'images/Nebula01.jpg';Picture[2]  = 'images/Nebula02.jpg';Picture[3]  = 'images/Nebula03.jpg';Picture[4]  = 'images/Nebula04.jpg';Picture[5]  = 'images/Nebula05.jpg';Picture[6]  = 'images/Nebula06.jpg';Picture[7]  = 'images/Nebula07.jpg';Picture[8]  = 'images/Nebula08.jpg';Picture[9]  = 'images/Nebula09.jpg';Picture[10] = 'images/Nebula10.jpg';// Specify the Captions...// To add more captions, just continue// the pattern, adding to the array below.// To use fewer captions, remove lines// starting at the end of the Caption array.// Caution: The number of Captions *must*// equal the number of Pictures!Caption[1]  = "This is the first caption.";Caption[2]  = "This is the second caption.";Caption[3]  = "This is the third caption.";Caption[4]  = "This is the fourth caption.";Caption[5]  = "This is the fifth caption.";Caption[6]  = "This is the sixth caption.";Caption[7]  = "This is the seventh caption.";Caption[8]  = "This is the eighth caption.";Caption[9]  = "This is the ninth caption.";Caption[10] = "This is the tenth caption.";// =====================================// Do not edit anything below this line!// =====================================var tss;var iss;var jss = 0;var pss = Picture.length-1;var preLoad = new Array();for (iss = 1; iss < pss+1; iss++){preLoad[iss] = new Image();preLoad[iss].src = Picture[iss];}function control(how){if (showHot){if (how=="H") jss = 1;if (how=="F") jss = jss + 1;if (how=="B") jss = jss - 1;if (jss > (pss)) jss=1;if (jss < 1) jss = pss;if (document.all){document.images.PictureBox.style.filter="blendTrans(duration=2)";document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";document.images.PictureBox.filters.blendTrans.Apply();}document.images.PictureBox.src = preLoad[jss].src;if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];if (document.all) document.images.PictureBox.filters.blendTrans.Play();}}</script>	<!--END of SLIDESHOW SCRIPT-->	</head><!--Body--><!--This bit in the line below about onload-'showHot=true;' seems to somehow disable the IE drop-down menu script.  This is only included on the slideshow page, not on other pages. --><body onload='showHot=true;'>

The php include file indicated in the above text is here. I use it in all my pages.

<link rel="SHORTCUT ICON" href="/favicon.ico">		<link href="http://www.test.spring-hill.net/spring-hill-default.css" rel="stylesheet" type="text/css" media="all">		<!--[if IE]><link rel="stylesheet" type="text/css" href="http://www.test.spring-hill.net/special-ie.css" /><![endif]-->								<script type="text/javascript"><!--//--><![CDATA[//><!--startList = function() {	if (document.all&&document.getElementById) {		navRoot = document.getElementById("nav");		for (i=0; i<navRoot.childNodes.length; i++) {			node = navRoot.childNodes[i];			if (node.nodeName=="LI") {				node.onmouseover=function() {					this.className+=" over";				}				node.onmouseout=function() {					this.className=this.className.replace(" over", "");				}			}		}	}	if (document.all&&document.getElementById) {		navRoot = document.getElementById("sub-nav");		for (i=0; i<navRoot.childNodes.length; i++) {			node = navRoot.childNodes[i];			if (node.nodeName=="LI") {				node.onmouseover=function() {					this.className+=" over";				}				node.onmouseout=function() {					this.className=this.className.replace(" over", "");				}			}		}	}}window.onload=startList;//--><!]]></script>

Link to comment
Share on other sites

both scripts are trying to use the onload event at the same time.comment out this line in the drop down menu script

//window.onload=startList;

then change you body onload to look like this

<body onload='function(){showHot=true;startList;}'>

that should do the trick

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...