Closed Thread Icon

Topic awaiting preservation: Help Pages that link to <a href="https://ozoneasylum.com/backlink?for=8109" title="Pages that link to Topic awaiting preservation: Help" rel="nofollow" >Topic awaiting preservation: Help\

 
Author Thread
Lala
Bipolar (III) Inmate

From: Montreal, Canada
Insane since: Feb 2002

posted posted 03-07-2002 00:36

I'm trying to make an animation that starts from the very left side of the screen to the right, dunno why it starts from the middle instead, any clue why?, i already tried everything.


<html><head><STYLE type="text/css">
<!--
.moveimage { position:absolute; left:10000; top:5; z-index:2 }
-->
</STYLE>
<SCRIPT language="JavaScript">
<!--
function moveit(spot)
{

if (document.layers)
{
var picture=document.image1;
if (spot<530)
{
picture.left= spot;
spot+=5;
setTimeout('moveit('+spot+')',100);
}
}

if (document.all)
{
var picture=document.all.image1.style;
if (spot<530)
{
picture.left= spot;
spot+=5;
setTimeout('moveit('+spot+')',100);
}
}
}

//-->
</SCRIPT>


<head>
<body onload="javascript:moveit(200)">

<DIV ID="image1" class="moveimage">
<IMG SRC="sucilogo.jpg">
</DIV>
</body>
<html>



Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 03-07-2002 05:15

You specify with this line

<body onload="javascript:moveit(200)">

that you want it to start at 200 pixels from the left.

Now, that line also has a fundamental problem: you need to know the difference between a javascript URL and a regular javascript statement.

You only use "javascript:" if the browser is expecting a URL. For instance:

<a href="JavaScript:myfunc();">...</a>

The browser is looking for http: or something there, but when it finds javascript:, it knows to execute the code instead of going to a URL.

In something like onload="" or onclick="" or whatever, you *don't* use "javascript:". The browser isn't expecting a URL there, it's expecting javascript code. So you just put the code right in there. You should change that line to

<body onload="moveit(0)">

and that should fix your problems.

Lala
Bipolar (III) Inmate

From: Montreal, Canada
Insane since: Feb 2002

posted posted 03-07-2002 18:59


Thanks very much that was driving me crazy


« BackwardsOnwards »

Show Forum Drop Down Menu