How to Display the Hours & Minutes in Two Fields With Javascript
- 1). Launch the standard, plain-text text editor application that is available on your computer.
- 2). Enter the following code into the text editor.
<html>
<body>
<script language="javascript">
var thedate = new Date();
var hours=thedate.getHours();
var minutes=thedate.getMinutes();
document.write("Hours field: "+hours);
document.write("");
document.write("Minutes field: "+minutes);
document.write("");
</script>
</body>
</html> - 3). Click the File menu. Select the "Save" option. Save under the file name "test.html."
- 4). Launch the web browser that is available on your computer. Click on the "File" menu item, and select "Open File."
- 5). Locate the file "test.html" just created, select it with the mouse, then click on "Open."
Source...