JQuery 第二章 JS课后

来源:互联网 发布:手机 java 编程 编辑:程序博客网 时间:2024/06/05 07:53
<!DOCTYPE html><html>  <head>    <title>kh4.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">     <script type="text/javascript">function disptime(){  var now= new Date();  var hour = now.getHours();  if (hour>=0 && hour <=12)document.write("<h2>上午好!欢迎来到贵美</h2>")  if (hour>12 && hour<= 18)    document.write("<h2>下午好!欢迎来到贵美</h2>");  if (hour>18 && hour <24)    document.write("<h2>晚上好!欢迎来到贵美</h2>");  document.write("<h2>今天日期:"+now.getYear()+"年"+(now.getMonth( )+1)+"月"+now.getDate()+"日</h2>");  document.write("<h2>现在时间:"+now.getHours()+"点"+now.getMinutes( )+"分</h2>");}</script>  </head>    <body>   <body  onLoad="disptime()">  </body></html>

<!DOCTYPE html><html>  <head>    <title>kh5.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <script type="text/javascript">var fruits=["apple","pear","peach","orange","banana"];var index=Math.floor(Math.random()*10%fruits.length);document.write("您得到的水果是:"+fruits[index]);</script>  </head>    <body>      </body></html>

0 0
原创粉丝点击