Code to create a button to display current date and time using JavaScript
Hi guys. Welcome to my blog Room Of Codes. So today I am going to teach you how to create a button to get present date and time using JavaScript...
So here is the xode to get the awesome button created using JavaScript...
"
<html>
<body>
<h2>My First JavaScript</h2>
<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="demo"></p>
</body>
</html>
"
To declare a button we use a button tag ...
Onclick refers that what should be done when the button is clicked...
And the other codes to used to create and refer the function and the function contains what has to be done.. theater function is called when the button is clicked ..
Hence when you type
<Button

Comments
Post a Comment