Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ok can someone tell me what is wron

Status
Not open for further replies.

3li773

Programmer
Jan 23, 2003
20
0
0
CA
ok can someone tell me what is wrong with this script. i get syntax errors on line 7 and 14 on character 1


<LAYER name=&quot;ani1&quot; bgColor=&quot;yellow&quot;>
O

<SCRIPT LANGUAGE=&quot;JavaScript1.2&quot;>
function move(x,y) { this.x = x; this.y = y; }

export move;
</SCRIPT>
</LAYER>


<SCRIPT LANGUAGE=&quot;JavaScript1.2&quot;>

import document.ani1.*;



var x = 0; y = 0;
setInterval(function() { move(x, y); x = (x + 5)%200; y = (y+5)%200; },
100);
</SCRIPT>

im opening it in IE
 
My first guess is that you are confusing Java with JavaScript. JavaScript doesn't support keywords like import and export.

My next guess is that you are trying to animate a piece of text by moving it diagonally down the page. Nothing wrong with that, but you might like to try...

* using a <div> instead of <layer>. layers were only really a Netscape thing anyway

* use style=&quot;position:absolute&quot; in the div. This tells the browser that your div doesn't fit in with the rest of the document flow.

* use style properties left and right to control the position of the div

something like...
<div id=&quot;ani1&quot; style=&quot;position:absolute; background:yellow&quot;>
Hello World
</div>
<SCRIPT LANGUAGE=&quot;JavaScript1.2&quot;>
function move(x,y)
{
document.getElementById('ani1').style.left = x;
document.getElementById('ani1').style.top = y;
}
var x = 0; y = 0;
setInterval(function() { move(x, y); x = (x + 5)%200; y = (y+5)%200; }, 100);
</SCRIPT>


Please note, the above code will not work on some older browsers (e.g. Netscape 4.7)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top