nice code but not working together

They have: 5 posts

Joined: Aug 1999

HI!!
there are two parts to the following code
func rotate() rotates a series of image indefinitely
and scrool() , start scroll () scroll a message indefinitely
when placed independently both of them work
but if they are in the same page they dont work......

i have tried calling the functions at different place but nothing seems to work
any ideas????
the code is below
<html>
<head>
<title>javascript</title>
<script language="Javascript">
<!--

var n=0;
timedelay=1000;

var imgs= new Array();
imgs[0]="dha.jpg";
imgs[1]="mda.jpg";
imgs[2]="ada.jpg";

function rotate()
{
document.picform.slideshow.src=imgs[n];
(n==(imgs.length-1))?n=0:n++;
window.setTimeout("rotate()",timedelay);
}

window.onload=rotate;
message="this is a scrolling message";
initial_delay=0;
scroll_delay=75;
max_indent=50;

function scroll()
{
message=message.substring(1,message.length)+ message.substring(0,1);
document.scrollbox_form.scrollbox.value=message;
window.setTimeout("scroll ()", scroll_delay);
}

function start_scroll()
{
for (var i=1; i<= max_indent; i++)
message=" " + message;
scrollbox=document.scrollbox_form.scrollbox;
window.setTimeout("scroll ()",initial_delay);
}
window.onload=start_scroll;
//-->
</script>
</head>
<body>
<form name=picform>
<img name=slideshow src="pic1.gif">
</form>

<form name=scrollbox_form >
<input type=text name=scrollbox size=25>
</form>
</body>
</html>

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Do you have a sample url we could check out, to see what errors or problems it is having?

They have: 5 posts

Joined: Aug 1999

sample URL???

pardon my ignorance,
do you mean some place on the net
where this code can be pasted......

actually i have this code on my hard disk..
can i put it on some free space available on the net

samit

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

try:
www.xoom.com

or

www.tripod.com

They offer you free webspace.You have to sign up first, though.

They have: 5,633 posts

Joined: Jan 1970

You can't use more than one occurence of the window.onload thingo.

I would suggest calling your functions like this.

<body
onload="javascript:rotate();start_scroll();">

------------------
http://go.to/hass

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.