123<title>JavaScript</title>4<script language= "JavaScript" >5 functionShowtime () {6 varNow_time =NewDate ();//Create a Time object7 varHours = Now_time.gethours ();//To get the current number of hours8 varminutes = Now_time.getminutes ();//get the current number of minutes9 varseconds = Now_time.getseconds ();//gets the current number of secondsTen varTimer = "" + ((Hours > 12)? Hours-12:hours);//assigning an hour value to a variable timer OneTimer + = ((minutes < 10)? ": 0": ":") + minutes;//assigning a minute value to a variable timer ATimer + = ((seconds < 10)? ": 0": ":") + seconds;//Assigning a second value to a variable timer -Timer + = "" + ((Hours > 12)? " PM ":" AM ");//Assign the character am or PM to a variable timer -Document.clock.show.value = timer;//output variable timer value in a form named Clock theSetTimeout ("Showtime ()", 1000);//set the Showtime () function to be called automatically once every second - } -</script> - +<body onload=showtime () > -<form name= "Clock" onsubmit= "0" > +<input type= "text" Name= "show" size= "Ten" style= "BACKGROUND-COLOR:LIGHTYELLO;BORDER-WIDTH:3;" > A</form> at</body> -JavaScript is also good to play Ah!
The above for the first JS applet implementation display the current time!
Front-end development self-study javascript--show Current time