Home > front end >  js
js

Time:09-30

Create a page, display the current date when the minutes of the day, click on the date of the current popup message box, "wishing you happiness for a day,"

Just started to learn, very meng, want to ask, thank you!

CodePudding user response:

Work to the

CodePudding user response:

 & lt; ! DOCTYPE html> 
& lt; HTML lang="en" & gt;

& lt; head>
& lt; Meta charset="utf-8" & gt;
& lt; Meta name="viewport" content="width=device - width, initial - scale=1.0" & gt;
& lt; title> Document
& lt;/head>

& lt; body>
& lt; Div id="date" & gt; & lt;/div>
& lt;/body>
& lt; script>
Let dateBox=document. GetElementById (" date "),
The date=new date (),
DateStr=date. ToLocaleString (),
Week=date. GetDay (),
WeekStr;
The switch (week) {
Case 0:
WeekStr='Sunday'
break;
Case 1:
WeekStr='Monday'
break;
Case 2:
WeekStr='Tuesday'
break;
Case 3:
WeekStr='on Wednesday,'
break;
Case 4:
WeekStr='Thursday'
break;
Case 5:
WeekStr='Friday'
break;
Case 6:
WeekStr='Saturday'
break;
Default:
break;
}
DateBox. The innerText=` ${dateStr} ${weekStr} `;
DateBox. Onclick=function () {
Alert (' if you are not in the fishing, can see in what stand for class B network video ');
}
& lt;/script>

& lt;/html>