Can any body help me, the button replace hours and minutes (HH:MM) onclick.
<button id="pressbtn1" onclick="getElementById('pressbtn1').innerHTML=Date()">Press</button>
Can any body help me, the button replace hours and minutes (HH:MM) onclick.
<button id="pressbtn1" onclick="getElementById('pressbtn1').innerHTML=Date()">Press</button>
Use .getHours()
and .getMinutes()
like...
<html>
<button id="pressbtn1" onClick="show()">Press</button>
<script>
function show()
{
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
document.getElementById("pressbtn1").innerHTML = h+":"+m;
}
</script>
</html>