August 17, 2014

Create a Digital clock in java script

java script example for how to use timer

Description : the program will help you to understand the working of timer and animation in html using javascript



<html>
<head>
<script type="text/javascript">
var c=0
var t
function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);

document.getElementById('clock').date=d;
var d= new Date();
}
</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onClick="timedCount()" />
<input type="text" id="txt" />
<input type="text"  id="clock"/>
</form>
</body>

</html>



Java script animation example


<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.getElementById("b1").src ="asiangames.gif";
}
function mouseOut()
{
document.getElementById("b1").src ="olympics.gif";
}
</script>
</head>

<body>
<a href="
http://javabelazy.blogspot.in/" target="_blank">
<img border="0" alt="Java best blog" src="asiangames.gif" id="b1"
onmouseover="mouseOver()" onmouseout="mouseOut()" /></a>
</body>
</html>


http://javabelazy.blogspot.in/

No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments