Blog author:
Ajay.Kalol | Posted on: 6/4/2012 | Category:
JavaScript Blogs | Views: 978 | Status:
[Member] |
Points: 75
|
Alert Moderator
Download source file
Image Rotation in JavaScript :
Script for Rotation :
<script type="text/javascript">
var
interval;
var Rad
= 10;
function
StartRotation() {
interval = setInterval(start, 150);
}
function
start() {
document.getElementById("ImgRotate").style.MozTransform = "rotate(" + Rad + "deg)";
document.getElementById("ImgRotate").style.webkitTransform = "rotate(" + Rad + "deg)";
Rad += 10;
}
function
StopRotation() {
clearInterval(interval);
}
</script>
<img alt="Img"
id="ImgRotate"
src="Images/DREAM-wall-1024-768.jpg"
width="120px"
height="120px" />
<br />
<br />
<input type="button" value="Start" onclick="StartRotation();" />
<input type="button" value="Stop" onclick="StopRotation();" />
http://ajaypatelfromsanthal.blogspot.in
Found interesting? Add this to: