Hello I am new to javascript. I have knowledge of Actionscript.
I am facing a problem regarding doctype.
I made a simple animation using javascript but it is not showing on firefox when using doctype,( IE, opera works).
Without doctype it works perfectly on 3of them.
Please help me..
my code goes below.
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script language="javascript" type="text/javascript" src="src/JSTweener.js"></script> <script language="javascript" type="text/javascript"> var total = 6; var counter=0; var pos; var imgwidth=950; function move1() { counter = counter+1; if(counter<total){ pos = 0-(950*counter); }else{ } JSTweener.addTween(container.style, { time: 1, transition: "easeInOutQuad", onComplete: move2, left:pos }); } function move2(){ alert(container.style.left); if(counter==total-1){ counter =0; container.style.left=0+'px'; } } </script> <style type="text/css"> #main{ position:absolute; overflow:hidden; width:950px; height:300px; } #container{ position:absolute; float:left; width:5px; left:0px; } .myclass{ float:left; z-index:0; } </style> </head> <body> <div id="main"> <div id="container" onClick="javascript:start()"> <div class="myclass"><img src="images/plate1.jpg"></div> <div class="myclass"><img src="images/plate2.jpg"></div> <div class="myclass"><img src="images/plate3.jpg"></div> <div class="myclass"><img src="images/plate4.jpg"></div> <div class="myclass"><img src="images/plate5.jpg"></div> <div class="myclass"><img src="images/plate1.jpg"></div> </div> </div> <script language="javascript" type="text/javascript"> function start(){ var container = document.getElementById('container'); container.style.width=imgwidth*total+'px'; move1(); } </script> </body> </html>


Reply With Quote
Bookmarks