Straight to the dry stuff

The dynamic text

<! DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="button" Value =" run "onclick="dong();" "> < div style =" box-sizing: border-box; color: RGB (74, 74, 74); > <h2 id=" HMSG "> </h2> <script type="text/javascript"> var msg=document.getElementById("hmsg").innerText; var intervalId=null; function dong(){ if(intervalId! =null) return; Function dong1(){var start= MSG. Substring (0,1); Var end= MSG. Substring (1); msg=end+start; document.getElementById("hmsg").innerText=msg; } intervalId = setInterval (dong1, 400); } function stop(){ clearInterval(intervalId); // Clear the timer, which is not set to null intervalId=null; } </script> </body> </html>Copy the code

Level 3 linkage

<! DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <select </select> <select id="city"> <option value="-1"> Select city </option> </select> <select id="district"> <option value="-1"> Please select the area </option> </select> </select> <script ProvinceArr = provinceArr; provinceArr= provinceArr; / var/save city array cityArr = [[" zhengzhou city ", "luoyang", "kaifeng"], [" suzhou ", "nanjing", "yangzhou city"], [" shijiazhuang ", "qinhuangdao", "zhangjiakou"]]. / var/save area array districtArr = [[[" zhongyuan district ", "erqi district", "HuiJi area", "jinshui district"], [" jianxi district ", "" the chan riverfront," nishinomiya area ", "jili"], [" longting district ", "shun HuiZu District river", "drum tower district", "yu queen cell area"]]. [[" wuzhong district ", "city", "gusu area", "wujiang district"], [" gulou ", "xuanwu borough", "jianye district", "qinhuai district"], [" straight ", "HanJiang area", "jiangdu district"]], [[" xinhua district ", "qiaoxi", "changan area", "yuhua district"]. [" Haikou District "," Shanhaiguan District "," Beidaihe District "," Funing District "], Function createOption(obj,data){for(var I in data){var op=new Option(data[i],i); obj.add(op); } } var province=document.getElementById("province"); createOption(province,provinceArr); var city=document.getElementById("city"); province.onchange=function(){ city.options.length=0; createOption(city,cityArr[province.value]); if(province.value>=0) city.onchange(); else location.reload(); } var district=document.getElementById("district"); city.onchange=function(){ district.options.length=0; createOption(district,districtArr[province.value][city.value]); } </script> </body> </html>Copy the code

Time countdown

<! DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <h1 Word-wrap: break-word! Important; ">< p align=center> <span id="time">< span style =" text-align: center language=JavaScript> var now = new Date(); function currenttime() { var dtime = new Date("02/04/2022"); now.setTime(now.getTime()+100); days = (dtime - now) / 1000 / 60 / 60 / 24; daysRound = Math.floor(days); hours = (dtime - now) / 1000 / 60 / 60 - (24 * daysRound); hoursRound = Math.floor(hours); minutes = (dtime - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound); minutesRound = Math.floor(minutes); if(minutesRound<=9) minutesRound="0"+minutesRound seconds = (dtime - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60  * hoursRound) - (60 * minutesRound); secondsRound = Math.floor(seconds); If (secondsRound<=9) secondsRound="0"+secondsRound time.innerHTML = daysRound + day +hoursRound +hour + minutesRound + SecondsRound + secondsRound; } setInterval("currenttime()",100); //--> </script> </html>Copy the code