abstrak:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>javascript小試牛刀之獲取時(shí)間</title> <script type="text/javascript">
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>javascript小試牛刀之獲取時(shí)間</title> <script type="text/javascript"> function box_1(q){ document.getElementsByClassName("box")[0].innerHTML="牛!" } function box_2(w){ w.style.borderRadius="30px" } var sj = new Date() function time0(){ document.write(sj+'<br>') } function time1(){ var month=new Array(12) month[0]="1月" month[1]="2月" month[2]="3月" month[3]="4月" month[4]="5月" month[5]="6月" month[6]="7月" month[7]="8月" month[8]="9月" month[9]="10月" month[10]="11月" month[11]="12月" document.write(sj.getFullYear()+"年"+month[sj.getMonth()]+sj.getDate()+"日"+'<br>') } function time2(){ document.write(sj.getHours()+"時(shí)"+sj.getMinutes()+"分"+sj.getSeconds()+"秒") } </script> </head> <body> 在下面框中點(diǎn)擊:加字:<div class="box" style="background:#ccc;width:100px;height:30px;" onclick="box_1(this)"></div> 在下面方框中雙擊:變圓角:<div id="box2" style="width:90px;height:90px;border:1px solid #ccc;" ondblclick="box_2(this)"></div> 當(dāng)前時(shí)間:<script>time0()</script> 當(dāng)前日期:<script>time1()</script> 當(dāng)前時(shí)間:<script>time2()</script> </body> </html>
Guru membetulkan:滅絕師太Masa pembetulan:2018-12-29 10:08:40
Rumusan guru:很好!就喜歡你這樣完成作業(yè)的,好習(xí)慣繼續(xù)保持!