PDA

View Full Version : I'm sorry for the noob question



Willdawg
07-19-2005, 01:56 AM
<html>
<head>
<script>
//sorry for sloppy script just testing :)
movecounter = 0;
function move1(){
playerxspeed=8;
playeryspeed=8;
oveTox=event.clientX;
oveToy=100;
you1.style.posLeft +=playerxspeed;
you1.style.posTop +=playeryspeed;
movetimer = setTimeout("move1();",60);
movecounter += 1;
tempc = movecounter*playerxspeed;
if(tempc >= oveTox){
clearTimeout(movetimer);
}
}
</script>
</head>
<body>
<table width="800" height="800">
<tr>
<td onclick="move1()">
<IMG id="you1" SRC="you.bmp" STYLE="position: absolute; z-index:3">
</td>
</tr>
</table>
</body>
</html>
this is my script I think the problem may be in the oveTox variable does it store as a string I dunno I just actually started coding again sorry for stupid question.

jscheuer1
07-19-2005, 03:16 AM
Events are handled differently in IE and Mozilla. This one works in IE6:

<html>
<head>
<script>
//sorry for sloppy script just testing
movecounter = 0;
function move1(e){
playerxspeed=3;
playeryspeed=3;
oveTox=e;
oveToy=600;
document.getElementById('you1').style.posLeft +=playerxspeed;
document.getElementById('you1').style.posTop +=playeryspeed;
movetimer = setTimeout("move1();",60);
movecounter += 1;
tempc = movecounter*playerxspeed;
if(tempc >= oveToy){
clearTimeout(movetimer);
}
}
</script>
</head>
<body>
<table width="800" height="800">
<tr>
<td onclick="move1(event.clientX)">
<IMG id="you1" SRC="some.jpg" STYLE="position: absolute; z-index:3">
</td>
</tr>
</table>
</body>
</html>

Willdawg
07-20-2005, 09:11 PM
Thanks for the help, as I said before I just started programming again and forget some of the less known commands.