js部分 document.addEventListener('touchstart',function(){ document.getElementById('music').play(); }, true);
var played = false; document.addEventListener('touchstart',function(){ if (played == false) { played = true; document.getElementById('music').play(); } }, false); html中的部分: <!--播放背景音乐容器--> <audio src="images/gongxi.mp3" id="music" autoplay="autoplay"></audio> <div> <script src="images/music.js"></script></div>
倒计时部分js代码: <!-- var day=""; var month=""; var year=""; var s="“春节”"; mydate=new Date(); mymonth=mydate.getMonth()+1; myday= mydate.getDate(); myyear= mydate.getYear(); year=(myyear > 200) ? myyear : 1900 + myyear; document.write("※今天是"+year+"年"+mymonth+"月"+myday+"日※"); document.write("<br>");
document.write("<br/>");
document.write('<span id="htright" class="float_r align_r"></span>'); function show_student_time(){ window.setTimeout("show_student_time()", 1000); BirthDay=new Date("2020/01/25"); today=new Date(); timeold=(BirthDay.getTime()-today.getTime()); sectimeold=timeold/1000; secondsold=Math.floor(sectimeold); msPerDay=24*60*60*1000; e_daysold=timeold/msPerDay; daysold=Math.floor(e_daysold); e_hrsold=(e_daysold-daysold)*24; hrsold=Math.floor(e_hrsold); e_minsold=(e_hrsold-hrsold)*60; minsold=Math.floor((e_hrsold-hrsold)*60); seconds=Math.floor((e_minsold-minsold)*60); htright.innerHTML='距'+s+' 还有 '+"<br/>"+daysold+'天 '+hrsold+'小时'+minsold+'分'+seconds+'秒' } show_student_time();
完成效果:点这里查看
--------------------我是有底线的------------------------
|