codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Animation works on IE but not on Firefox  Blue_Crystal at 13:36 on Wednesday, January 21, 2009
 

I made a scale animation that works on IE 7 but it does not work on Firefox 3.

The button toggles between scaling up and down.

In Firefox , it shows a weird behavior: it starts the loop for scaling up but it is quickly interrupted and return to its original scale.

What should I change in the below code to make it also functional on Firefox 3 ?

<head>

<script language="javascript">


var obj = null;

var toggle = 0;

var w = 55;

var h = 40;

var w_speed = 22;

var h_speed = 16;

function init()
{

obj = document.getElementById("vase").style;

obj.width = 55 + "px";
obj.height = 40 + "px";

}


function ChangeScale()
{


if(toggle == 0)
{
w += w_speed;
h += h_speed;

obj.width = w + "px";
obj.height = h + "px";

if(w < 550) setTimeout("ChangeScale()",1);
else
{

obj.width = 550 + "px";
obj.height = 400 + "px";

toggle = 1;

return;


}
}

else
if(toggle == 1)
{
w -= w_speed;
h -= h_speed;

obj.width = w + "px";
obj.height = h + "px";

if(w > 55) setTimeout("ChangeScale()",1);
else
{

obj.width = 55 + "px";
obj.height = 40 + "px";

toggle = 0;

return;


}
}


}


window.onload = init;



</script>



</head>

<body bgcolor="#ffffff" background="/forum/pattern_flowers.jpg" >


<div style="position:absolute; top:240px; left:90px;">
<a href="" onClick="ChangeScale()"><img id="button" src="Button.jpg"></img></a>
</div>


<div style="position:absolute; top:20px; left:400px;">
<img id="vase" src="/forum/Vase.jpg"></img>
</div>



</body>
</html>










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Animation works on IE but not on Firefox
•  Re: Add an OnChange event to an ASP page
•  Re: combined 3 functions that do the same thing
•  Button link to excel
•  parser project needs c++ programmer
•  Simple Thumbnail Solution
•  Re: hex code of a number
•  sql query
•  Re: number of regex match


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009