2019-02-25 課堂練習3

以下為 給出的原始鏈接 進行改動 創(chuàng)建外部鏈接

···
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>隨機抽題系統(tǒng)</title>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% "Microsoft YaHei","微軟雅黑", "宋體";}

    #bodybj{background:url(images.jpg) no-repeat center top;}
    #box{margin:auto;width:660px;font-size:66px;height:94px;line-height:94px;overflow:hidden;color:#138eee;text-align:center;padding:0 30px;margin-top:200px;}
    #bt{margin:auto;width:200px;text-align:center;margin-top:75px;color:#fff;font-size:25px;line-height:28px;cursor:pointer;}
    </style>
    
    <script type="text/javascript">
    var namelist=[
    "1號球","2號球","3號球","4號球","5號球","6號球","7號球","8號球","9號球","10號球"];
    var mytime=null;
    
    function doit(){
        var bt=window.document.getElementById("bt");
        if(mytime==null){
            bt.innerHTML="停止抽獎";
            show();                    
        }else{
            bt.innerHTML="開始抽獎";
            clearTimeout(mytime);
            mytime=null;                    
        }
    }
    
    function show(){
        var box=window.document.getElementById("box");
        var num=Math.floor((Math.random()*100000))%namelist.length;
        box.innerHTML=namelist[num];
        mytime=setTimeout("show()",1);
    } 
    </script>
</head>
<body id="bodybj">
    <div id="box">準備好了,開始抽獎了</div>
    <div id="bt" onClick="doit()">開始抽獎</div>
    
    <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
    <p>適用瀏覽器:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. </p>
    
    </div>
</body>

</html>



把              script    標簽中的東西    復制      
不要復制了    這個標簽名       
![](https://upload-images.jianshu.io/upload_images/12642951-1e5bbc10bd4353ca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
li'de
里的東西復制到另一個html里就行了
EG:
var namelist=[
        "1號球","2號球","3號球","4號球","5號球","6號球","7號球","8號球","9號球","10號球"];
        var mytime=null;
        
        function doit(){
            var bt=window.document.getElementById("bt");
            if(mytime==null){
                bt.innerHTML="停止抽獎";
                show();                    
            }else{
                bt.innerHTML="開始抽獎";
                clearTimeout(mytime);
                mytime=null;                    
            }
        }
        
        function show(){
            var box=window.document.getElementById("box");
            var num=Math.floor((Math.random()*100000))%namelist.length;
            box.innerHTML=namelist[num];
            mytime=setTimeout("show()",1);
        } // JavaScript Document



然后    創(chuàng)建外部鏈接    連接到 上述html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<script type="text/javascript" src="789.js"></script>
</head>

<body>
</body>
</html>
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML標準。 注意:講述HT...
    kismetajun閱讀 28,818評論 1 45
  • 第一章 HTML基礎 本章目標 會使用HTML的基本結構創(chuàng)建網(wǎng)頁【重點】 會使用文本相關標簽排版文本信息【重點】 ...
    c592a8530dfe閱讀 699評論 0 0
  • HTML、XML、XHTML 有什么區(qū)別 1.HTML 是用來描述網(wǎng)頁的一種語言,指的是超文本標記語言 (Hype...
    饑人谷_牛牛閱讀 827評論 0 2
  • 今天下午陽光明媚,北京少有的好天氣。正好有機會總結HTML標簽,下面就詳細介紹一下基礎的標簽的用法及相關的屬性。關...
    gyc0530閱讀 520評論 0 1
  • HTML、XML、XHTML有什么區(qū)別? XMLXML是The Extensible Markup Languag...
    zx9426閱讀 517評論 0 1

友情鏈接更多精彩內容