HTML + Javascript together
by mickeys
HTML
<html>
<head>
<!--
! Javascript functions are created in the head section of the web page.
! showTime() takes no parameters and returns an English sentence with
! the current time.
-->
<script type="text/javascript">
function showTime() {
alert("It's " + new Date().toLocaleTimeString('en-US') + " right now.")
}
</script>
</head>
<body>
<p>Click the button!</p>
<!--
! The showTime() function is used as the event handler for this button.
! This should be supported in every modern web browser.
-->
<form>
<input type="button" value="What time is it?" onclick="showTime()" />
</form>
</body>
</html>