PDA

View Full Version : I am trying to run two scripts on the front page



paynecou
05-19-2005, 10:11 PM
I am trying to run a menu script and a scroller script on the same page. page was working fine when I have just menu on it or just scroller on it. Minute I add second script in the header the menu quits. What do I do?

here is <head> script one:
<script type="text/javascript" src="includes/browser.js">
/***********************************************
* Jim's DHTML Menu v5.7- Jim Salyer (jsalyer@REMOVETHISmchsi.com)
* Visit Dynamic Drive: http://www.dynamicdrive.com for script and instructions
* This notice must stay intact for use
***********************************************/
</script>
<script type="text/javascript" src="config.js"></script>




here is <head> script two:
<script type="text/javascript" language="JavaScript1.2" src="ajlib.js"></script>
<script type="text/javascript" language="JavaScript1.2" src="ajscroller.js"></script>

Please, I do not know a thing about Java.. can someone help me figure this out, please? thanks in advance.. PCL

jscheuer1
05-19-2005, 10:30 PM
.fkjhgljgdlgxdkxgclf;iufy

paynecou
05-19-2005, 10:41 PM
I had no idea where to even start. I have all the time in the world, and am glad to do it myself. I just had no idea where to even start. Thanks for taking the time to "show me the way". I really appreciate it very much. s

JavaTom
05-29-2005, 01:20 AM
paynecou:

I am also successfully running more than one javascript on an html page..
If you review the code posted below, you'll see How I call each of the scripts..



<html>
<head><title>Welcome to PSP Embroidery!</title>
<script language="JavaScript" type="text/javascript" >
if (document.images) {
var boardNum = 0;
var boardSpeed = 2000;

// Create an array of images for the billboard
var billboard = new Array();
billboard[0] = new Image();
billboard[0].src = "zsk-intl.jpg";
billboard[1] = new Image();
billboard[1].src = "ginko.gif";
billboard[2] = new Image();
billboard[2].src = "squirrel_logo.gif";

// Create an array of URLs that correspond to the images
var url = new Array();
url[0] = "http://www.zsk.com";
url[1] = "http://www.strawberrystitch.com/shop/GD-Sales.html";
url[2] = "http://www.gonutsgocreative.com/home/default.asp";
}

// Function to rotate the images on the billboard
function rotateBoard() {
if (boardNum < (billboard.length - 1)) {
boardNum++;
}
else {
boardNum = 0;
}
document.billboard.src = billboard[boardNum].src;
setTimeout('rotateBoard()', boardSpeed);
}

// Function to load the appropriate URL when the user clicks on an image
function jumpBillboard() {
window.location = url[boardNum];
}

</script>
<SCRIPT SRC=ban1_rotate.js LANGUAGE=
JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
</SCRIPT>
</head>

<body BACKGROUND="scotch.bmp" onLoad="rotate();if (document.images) setTimeout('rotateBoard()', boardSpeed);">


See, one of the critical things is that you enclose your individual scripts within their respective <script></script> tags, and that you handle the call to the functions properly within the <BODY> tag, like above!

Review this link: http://www.javascriptkit.com/javatutors/multiplejava.shtml

Good Luck!
JavaTom