Save this text in a .js file and load the .js file locally in your browser:
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the milliseconds of the time right now.</p>
<button onclick="myFunction()">Roll Die</button>
<button onclick="addNewLine()">Br</button>
<p id="demo"></p>
<script>
function myFunction() {
var d = new Date();
var n = 1 + d.getMilliseconds() % 6;
document.getElementById("demo").innerHTML += n;
}
function addNewLine() {
document.getElementById("demo").innerHTML += '<br>';
}
</script>
</body>
</html>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.