<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Document</title></head><scriptsrc="../js/jquery-3.6.0.min.js"></script><body><!-- 1、实现图片轮播的效果,即:图片不停的切换--><imgid="i1"><script>var i =0;functionlimg(){var img =[11,22,33];var a = document.getElementById("i1");
a.src ="../css/"+ img[i]+".png";
a.width =800;
a.height =400;
i++;if(i >2){
i =0;}}setInterval(limg,1000);</script></body></html>
2、本地同步显示时间(即,在页面上显示实际的时间)
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Document</title></head><pid="p"></p><body><!-- 2、本地同步显示时间(即,在页面上显示实际的时间) --><script>functiongetTimer(){var a =newDate();var h = a.getHours();var m = a.getMinutes();var s = a.getSeconds();if(a.getHours()<10){
h ="0"+ a.getHours();}elseif(a.getMinutes()<10){
m ="0"+ a.getMinutes();}elseif(a.getSeconds()<10){
s ="0"+ a.getSeconds();}var z = document.getElementById("p").innerText = h +":"+ m +":"+ s;}getTimer();setInterval(getTimer,1000);</script></body></html>