Requirement Description: Make a display of the year, month, day, weekday and show The Morning (AM) and PM (PM)
12 binary clock, the specific effect is as follows:
The code is as follows:
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><Metahttp-equiv= "Content-type"content= "text/html charset=utf-8"><HTML><Head> <title>Get Date</title> <styletype= "Text/css">P{Font-weight:Bold; } </style> <Scripttype= "Text/javascript" > functionFun () {//Create a new Date object varDate=NewDate (); var Year=date.getfullyear (); varMonth=Date.getmonth (); var Day=date.getdate (); varHour=date.gethours (); varminutes=date.getminutes (); varseconds=date.getseconds (); varWeek=Date.getday (); if(Week==1) {Week="a"; }if(Week==2) {Week="two"; } if(Week==3) {Week="three"; } if(Week==4) {Week="Four"; } if(Week==5) {Week="Five"; } if(Week==6) {Week="Six"; } if(Week==7) {Week="Day"; } varam=""; if(Hour>=0 &&Hour<= A) {am= "AM"; }Else{am= "PM"} document.getElementById ("Date"). InnerHTML= Year+"years"+Month+"Month"+ Day+"Day"+" "+Hour+":"+minutes+":"+seconds+" "+am+"Week"+Week; } onload= function() {setinterval ("Fun ()", -); } </Script></Head><Body> <H1>Hello, welcome to visit your U.S. mall!</H1> <PID= "Date"></P></Body></HTML>
JavaScript Making clock effects