Thursday, 27 February 2014
Digital Clock in Browser
Click button will show clock.
here is code
<HTML>
<head><title></title>
<script>
function time()
{
var d=new Date();
H= d.getHours();
M= d.getMinutes()
S= d.getSeconds()
document.getElementById("timer1").innerHTML= H +":"+M +":"+S;
setTimeout(function(){time()},500);
setInterval(function(){time()},1000);
}
</script>
</head>
<body>
<div id="timer1" style="float:right";>
<button type="button" onClick="time();"style="float:right">Clock</button><br />
</div>
</body>
Wednesday, 26 February 2014
Simple Timer in Java Script
0
Here is code, hope you enjoyed.
This is simples Javascript code you ever seen for a timer.
<html>
<head><title></title>
<script>
function ctime()
{
var int = setInterval(function(){updateField();},1000);
}
function updateField()
{
var t = document.getElementById('timer').innerHTML;
var inc= (parseInt(t)+1);
document.getElementById("timer").innerHTML=inc;
</script>
</head>
<body>
<div id="bt_timer" style="float: right;">
<button onclick="ctime();" style="float: right;" type="button">Timer</button><br />
<div id="timer">0</div>
</div>
</body>
</html>
Subscribe to:
Posts (Atom)