Create A HTML Page Insert A Image And Button In Page When A Click To A Button Image Should Shifted To Right Until Stop Button Not Press
NOTE: When Double Click On the Start Button It Speed Should Be Double As So On There are a lot of possibilities for people who want to change something in the interior design of their houses. If you want to change the style of the whole room, colour scheme, lighting type, or furniture, with https://www.prints4sure.com you can do it with ease.
Code Start Here
Click.html
<html>
<head>
<title>JavaScript Animation</title>
<script type="text/javascript">
<!--
var img = null;
var animate ;
function init(){
img = document.getElementById('myImage');
img.style.position= 'relative';
img.style.left = '0px';
}
function moveRight(){
img.style.left = parseInt(img.style.left) + 10 + 'px';
animate = setTimeout(moveRight,20); // call moveRight in 20msec
}
function stop(){
clearTimeout(animate);
img.style.left = '0px';
}
window.onload =init;
//-->
</script>
</head>
<body>
<form>
<img id="myImage" src="Desert.jpg" height="400" width="600" />
<p>Click the buttons below to handle animation</p>
<input type="button" value="Start" onclick="moveRight();" />
<input type="button" value="Stop" onclick="stop();" />
</form>
</body>
</html>
Output:-
NOTE: When Double Click On the Start Button It Speed Should Be Double As So On There are a lot of possibilities for people who want to change something in the interior design of their houses. If you want to change the style of the whole room, colour scheme, lighting type, or furniture, with https://www.prints4sure.com you can do it with ease.
Code Start Here
Click.html
<html>
<head>
<title>JavaScript Animation</title>
<script type="text/javascript">
<!--
var img = null;
var animate ;
function init(){
img = document.getElementById('myImage');
img.style.position= 'relative';
img.style.left = '0px';
}
function moveRight(){
img.style.left = parseInt(img.style.left) + 10 + 'px';
animate = setTimeout(moveRight,20); // call moveRight in 20msec
}
function stop(){
clearTimeout(animate);
img.style.left = '0px';
}
window.onload =init;
//-->
</script>
</head>
<body>
<form>
<img id="myImage" src="Desert.jpg" height="400" width="600" />
<p>Click the buttons below to handle animation</p>
<input type="button" value="Start" onclick="moveRight();" />
<input type="button" value="Stop" onclick="stop();" />
</form>
</body>
</html>
Output:-
0 Comments: