PROGRAM IN JAVASCRIPT GETTING CURRENT TIME AND UPDATING TEXT FIELD

<html>
<body>

<p>Click the button to display the date in text box</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var d = new Date();
    var ansD = document.getElementById("date");
    ansD.value=d;

}
</script>
DATE:<input type="text" id="date" name="date" value=""/>
</body>
</html>

No comments:

Post a Comment