Hey. I am new to webprogramming..so sorry if this question sounds stupid:D
I just wanted to make an animation but in firefox that animation just doesnt appear tho it works great in IE and opera. Do you have any idea what's wrong? I use the function setTimeout() and document.all[id].style...etc to take the value I need. No error but no animation as well=\

Recommended Answers

All 4 Replies

You will have to post the code.

BTW: document.all is deprecated at best and unsupported at worst; use document.getElementById('x') instead.

aw well my code was very complicated..jst help me with this one i will figure out with mine

<input type="button" onclick="move()" value="go" />
<br />
<img src="btn16.gif" style=" position:absolute; height:100px; width:100px; top:20px" id="img" />
<script>
var k=0;
function move(){
var t=document.getElementById("img").style.top;
t=parseInt(t);
t+=15;
document.getElementById("img").style.top=t;
if(k<10){
k++;
setTimeout("move()",1);
}
}
</script>

This

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title></title>
  </head>
  <body>
    <form>
      <input type="button" onclick="mve()" value="go"><br>
    </form>
    <img src="btn16.gif" style="position:relative; height:100px; width:100px; top:0px" id="img" name="img"> 

<script type="text/javascript">

var oImg = document.getElementById("img")
var t = parseInt(oImg.style.top)
var k = 0;

function mve() {
    t += 15;
    oImg.style.top = t + 'px'
    if (k++ < 10) { setTimeout("mve()", 100); }
}

</script>
  </body>
</html>

works fine here in all browsers.

Note: if you set the timeout to a small number [like 1] and your machine is fast enough, the image will appear to jump instead of sliding.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.