掃什麼,評什麼

今天打開朋友圈,許多朋友都在發「掃什麼評什麼」,雖然這個只是一個朋友圈遊戲,可是做爲一個程序員,老是想去研究一下他究竟是怎麼實現的,打開源代碼一看便知道怎麼來實現這麼一個「遊戲」。javascript

clipboard.png

接下來,簡單的分析一下,有過網站基礎的朋友一看就知道怎麼來實現的,並無什麼技術含量。css

界面代碼html

咱們先無論複製怎麼顯示,只要「變化」的文字實現原理java

clipboard.png

引用文字jquery

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>你也來試試!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0 user-scalable=no">

<script src="http://css.0826.cc/w/clipboard.min.js"></script>

<script type="text/javascript" src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://css.0826.cc/w/style.css" media="screen">
<style>
body{
    background: #eaeaea;
}
main{
    width: 100%;
    height: 30rem;
}
.contents{
    padding: 15rem 0;
}
#content-desc{
    width: 85%;
    margin: -102px auto;
    font-family: KaiTi;
    //font-size: 19px;
}
footer{
    width: 100%;
}
ul{
    width: 70%;
    margin: -80px 5%;
}
li{
    list-style: none;
    width: 90%;
    height: 2rem;
    text-align: center;
    margin-top: 10px;
    border: 1.9px solid black;
    border-radius:8px;
    margin: 10px auto;
    line-height: 2rem;
    font-size: 1rem;
    font-family: KaiTi;
    cursor: pointer;
    font-weight: bold;

}

    #content-desc span{  
        float:left;  
        position: relative;  
    }  

    #content-desc span:nth-child(1){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(2){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(3){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(4){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(5){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(6){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(7){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(8){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(9){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(10){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(11){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(12){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(13){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(14){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(15){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(16){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(17){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(18){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(19){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(20){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(21){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(22){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(23){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(24){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(25){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(26){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(27){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(28){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }  

    #content-desc span:nth-child(29){  
        -webkit-animation:jump 1s linear 0.6s infinite alternate;  
    }  

    #content-desc span:nth-child(30){  
        -webkit-animation:jump 1s linear 0.8s infinite alternate;  
    }  
    #content-desc span:nth-child(31){  
        -webkit-animation:jump 1s linear 0s infinite alternate;  
    }  

    #content-desc span:nth-child(32){  
        -webkit-animation:jump 1s linear 0.2s infinite alternate;  
    }  

    #content-desc span:nth-child(33){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    
     #content-desc span:nth-child(34){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(35){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(36){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(37){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(38){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
    #content-desc span:nth-child(39){  
        -webkit-animation:jump 1s linear 0.4s infinite alternate;  
    }
 


    @-webkit-keyframes jump  
    {  
        0%{  
            top:0px;  
            color:#fbb2b2;  
        }  
        50%{  
            top:-3px;  
            color:#0e8761;  
        }  
        100%{  
            top:2px;  
            color:#327fc2;  
        }  
    }  

    </style>

<meta name="GENERATOR" content="MSHTML 9.00.8112.16723"></head>
<body>
<main>
    <article class="contents">
        <div id="content-desc"><span class="span1">來</span><span class="span2">,</span><span class="span3">有</span><span class="span4">事</span><span class="span5">牀</span><span class="span6">上</span><span class="span7">聊</span><span class="span8">。</span></div>
    </article>
</main>
<footer>
<nav>
<ul>
  <li class="btn">                點擊複製這句話            </li>
  <li class="jump">                            我也要玩                        </li>
</ul>
</nav>
<input class="weburl" value="https://mp.weixin.qq.com/s/h7SGqC8yJ2d0iq1yq4mEgw" type="hidden">
</footer>
<script type="text/javascript">

var rand1 = parseInt(Math.random()*40);
quotes = new Array;
quotes[0] = '<span class="span1">你</span><span class="span2">會</span><span class="span3">不</span><span class="span4">會</span><span class="span5">突</span><span class="span6">然</span><span class="span7">地</span><span class="span8">出</span><span class="span9">現</span><span class="span10">,</span><span class="span11">在</span><span class="span12">街</span><span class="span13">角</span><span class="span14">的</span><span class="span15">大</span><span class="span16">保</span><span class="span17">健</span><span class="span18">。</span>';

quotes[1] = '<span class="span1">如</span><span class="span2">何</span><span class="span3">證</span><span class="span4">明</span><span class="span5">你</span><span class="span6">的</span><span class="span7">實</span><span class="span8">力</span><span class="span9">?</span><br><span class="span10">住</span><span class="span11">酒</span><span class="span12">店</span><span class="span13">一</span><span class="span14">定</span><span class="span15">要</span><span class="span16">選</span><span class="span17">隔</span><span class="span18">音</span><span class="span19">最</span><span class="span20">好</span><span class="span21">的</span><span class="span22">。</span>';

quotes[2] = '<span class="span1">你</span><span class="span2">的</span><span class="span3">名</span><span class="span4">字</span><span class="span5">是</span><span class="span6">最</span><span class="span7">短</span><span class="span8">的</span><span class="span9">情</span><span class="span10">詩</span><span class="span11">。</span>';

quotes[3] = '<span class="span1">爲</span><span class="span2">了</span><span class="span3">節</span><span class="span4">約</span><span class="span5">用</span><span class="span6">水</span><span class="span7">,</span><span class="span8">今</span><span class="span9">晚</span><span class="span10">可</span><span class="span11">以</span><span class="span12">一</span><span class="span13">起</span><span class="span14">洗</span><span class="span15">澡</span><span class="span16">嗎</span><span class="span17">?</span>';

quotes[4] = '<span class="span1">像</span><span class="span2">你</span><span class="span3">這</span><span class="span4">種</span><span class="span5">平</span><span class="span6">胸</span><span class="span7">的</span><span class="span8">,</span><span class="span9">只</span><span class="span10">能</span><span class="span11">好</span><span class="span12">好</span><span class="span13">學</span><span class="span14">習</span>';

quotes[5] = '<span class="span1">現</span><span class="span2">在</span><span class="span3">的</span><span class="span4">男</span><span class="span5">朋</span><span class="span6">友</span><span class="span7">應</span><span class="span8">該</span><span class="span9">像</span><span class="span10">蚊</span><span class="span11">子</span><span class="span12">一</span><span class="span13">樣</span><span class="span14">,</span><span class="span15">一</span><span class="span16">不</span><span class="span17">留</span><span class="span18">神</span><span class="span19">就</span><span class="span20">讓</span><span class="span21">你</span><span class="span22">手</span><span class="span23">上</span><span class="span24">多</span><span class="span25">個</span><span class="span26">包</span><span class="span27">。</span>';

quotes[6] = '<span class="span1">「寶</span><span class="span2">貝</span><span class="span3">,</span><span class="span4">我</span><span class="span5">想</span><span class="span6">給</span><span class="span7">你</span><span class="span8">整</span><span class="span9">個</span><span class="span10">世</span><span class="span11">界</span><span class="span12">。」</span><br><span class="span13">「那</span><span class="span14">你</span><span class="span15">整</span><span class="span16">吧</span><span class="span17">!」</span>';

quotes[7] = '<span class="span1">你</span><span class="span2">所</span><span class="span3">有</span><span class="span4">爲</span><span class="span5">人</span><span class="span6">稱</span><span class="span7">道</span><span class="span8">的</span><span class="span9">美</span><span class="span10">麗</span><span class="span11">,</span><span class="span12">都</span><span class="span13">有</span><span class="span14">美</span><span class="span15">圖</span><span class="span16">秀</span><span class="span17">秀</span><span class="span18">的</span><span class="span19">痕</span><span class="span20">跡</span><span class="span21">。</span>';

quotes[8] = '<span class="span1">別</span><span class="span2">人</span><span class="span3">笑</span><span class="span4">起</span><span class="span5">來</span><span class="span6">的</span><span class="span7">樣</span><span class="span8">子</span><span class="span9">很</span><span class="span10">好</span><span class="span11">看</span><span class="span12">,</span><span class="span13">你</span><span class="span14">笑</span><span class="span15">起</span><span class="span16">來</span><span class="span17">的</span><span class="span18">樣</span><span class="span19">子</span><span class="span20">很</span><span class="span21">好</span><span class="span22">笑</span><span class="span23">。</span>';

quotes[9] = '<span class="span1">如</span><span class="span2">果</span><span class="span3">你</span><span class="span4">前</span><span class="span5">女</span><span class="span6">友</span><span class="span7">和</span><span class="span8">現</span><span class="span9">女</span><span class="span10">友</span><span class="span11">同</span><span class="span12">時</span><span class="span13">掉</span><span class="span14">到</span><span class="span15">河</span><span class="span16">裏</span><span class="span17">了</span><span class="span18">,</span><span class="span19">那</span><span class="span20">麼</span><span class="span21">,</span><span class="span22">請</span><span class="span23">問</span><span class="span24">我</span><span class="span25">可</span><span class="span26">以</span><span class="span27">作</span><span class="span28">你</span><span class="span29">女</span><span class="span30">朋</span><span class="span31">友</span><span class="span32">麼</span><span class="span33">?</span>';

quotes[10] = '<span class="span1">睡</span><span class="span2">不</span><span class="span3">到</span><span class="span4">我</span><span class="span5">,</span><span class="span6">你</span><span class="span7">的</span><span class="span8">人</span><span class="span9">生</span><span class="span10">還</span><span class="span11">有</span><span class="span12">什</span><span class="span13">麼</span><span class="span14">意</span><span class="span15">義</span><span class="span16">。</span>';

quotes[11] = '<span class="span1">你</span><span class="span2">復</span><span class="span3">雜</span><span class="span4">的</span><span class="span5">五</span><span class="span6">官</span><br><span class="span7">掩</span><span class="span8">飾</span><span class="span9">不</span><span class="span10">了</span><span class="span11">你</span><span class="span12">樸</span><span class="span13">素</span><span class="span14">的</span><span class="span15">智</span><span class="span16">商</span><span class="span17">。</span>';

quotes[12] = '<span class="span1">你</span><span class="span2">認</span><span class="span3">真</span><span class="span4">的</span><span class="span5">樣</span><span class="span6">子</span><span class="span7">就</span><span class="span8">像</span><span class="span9">天</span><span class="span10">橋</span><span class="span11">上</span><span class="span12">貼</span><span class="span13">膜</span><span class="span14">的</span><span class="span15">。</span>';

quotes[13] = '<span class="span1">從</span><span class="span2">此</span><span class="span3">我</span><span class="span4">愛</span><span class="span5">的</span><span class="span6">人</span><span class="span7">都</span><span class="span8">不</span><span class="span9">像</span><span class="span10">你</span><span class="span11">。</span>';

quotes[14] = '<span class="span1">我</span><span class="span2">喜</span><span class="span3">歡</span><span class="span4">你</span><span class="span5">,</span><span class="span6">就</span><span class="span7">像</span><span class="span8">你</span><span class="span9">媽</span><span class="span10">打</span><span class="span11">你</span><span class="span12">不</span><span class="span13">講</span><span class="span14">道</span><span class="span15">理</span><span class="span16">。</span>';

quotes[15] = '<span class="span1">青</span><span class="span2">春</span><span class="span3">荒</span><span class="span4">唐</span><span class="span5">不</span><span class="span6">負</span><span class="span7">你</span><span class="span8">,</span><br><span class="span9">全</span><span class="span10">套</span><span class="span11">包</span><span class="span12">夜</span><span class="span13">八</span><span class="span14">百</span><span class="span15">起</span><span class="span16">。</span>';

quotes[16] = '<span class="span1">希</span><span class="span2">望</span><span class="span3">一</span><span class="span4">切</span><span class="span5">事</span><span class="span6">情</span><span class="span7">都</span><span class="span8">像</span><span class="span9">長</span><span class="span10">胖</span><span class="span11">那</span><span class="span12">麼</span><span class="span13">容</span><span class="span14">易</span>';

quotes[17] = '<span class="span1">我</span><span class="span2">養</span><span class="span3">你</span><span class="span4">啊</span><span class="span5">。</span>';

quotes[18] = '<span class="span1">我</span><span class="span2">來</span><span class="span3">到</span><span class="span4">你</span><span class="span5">的</span><span class="span6">城</span><span class="span7">市</span><span class="span8">,</span><br><span class="span9">你</span><span class="span10">卻</span><span class="span11">不</span><span class="span12">管</span><span class="span13">頓</span><span class="span14">飯</span><span class="span15">吃</span><span class="span16">。</span>';

quotes[19] = '<span class="span1">你</span><span class="span2">走</span><span class="span3">了</span><span class="span4">真</span><span class="span5">好</span><span class="span6">,</span><br><span class="span7">不</span><span class="span8">然</span><span class="span9">總</span><span class="span10">擔</span><span class="span11">心</span><span class="span12">你</span><span class="span13">要</span><span class="span14">留</span><span class="span15">下</span><span class="span16">來</span><span class="span17">吃</span><span class="span18">飯</span><span class="span19">。</span>';

quotes[20] = '<span class="span1">以</span><span class="span2">後</span><span class="span3">的</span><span class="span4">路</span><span class="span5">你</span><span class="span6">自</span><span class="span7">己</span><span class="span8">走</span><span class="span9">,</span><span class="span10">我</span><span class="span11">打</span><span class="span12">車</span><span class="span13">。</span>';

quotes[21] = '<span class="span1">手</span><span class="span2">不</span><span class="span3">要</span><span class="span4">給</span><span class="span5">別</span><span class="span6">人</span><span class="span7">牽</span><span class="span8">,</span><br><span class="span9">擁</span><span class="span10">抱</span><span class="span11">也</span><span class="span12">要</span><span class="span13">留</span><span class="span14">給</span><span class="span15">我</span><span class="span16">。</span>';

quotes[22] = '<span class="span1">愛</span><span class="span2">你</span><span class="span3">就</span><span class="span4">像</span><span class="span5">拉</span><span class="span6">肚</span><span class="span7">子</span><span class="span8">一</span><span class="span9">樣</span><span class="span10">無</span><span class="span11">法</span><span class="span12">控</span><span class="span13">制</span><span class="span14">。</span>';

quotes[23] = '<span class="span1">如</span><span class="span2">果</span><span class="span3">再</span><span class="span4">見</span><span class="span5">不</span><span class="span6">能</span><span class="span7">紅</span><span class="span8">着</span><span class="span9">臉</span><span class="span10">,</span><br><span class="span11">是</span><span class="span12">否</span><span class="span13">還</span><span class="span14">能</span><span class="span15">借</span><span class="span16">點</span><span class="span17">錢</span><span class="span18">。</span>';

quotes[24] = '<span class="span1">雖</span><span class="span2">然</span><span class="span3">你</span><span class="span4">長</span><span class="span5">的</span><span class="span6">醜</span><span class="span7">,</span><span class="span8">但</span><span class="span9">你</span><span class="span10">想</span><span class="span11">的</span><span class="span12">美</span><span class="span13">啊</span><span class="span14">!</span>';

quotes[25] = '<span class="span1">有</span><span class="span2">空</span><span class="span3">一</span><span class="span4">起</span><span class="span5">睡</span><span class="span6">覺</span><span class="span7">啊</span><span class="span8">?</span>';

quotes[26] = '<span class="span1">來</span><span class="span2">,</span><span class="span3">有</span><span class="span4">事</span><span class="span5">牀</span><span class="span6">上</span><span class="span7">聊</span><span class="span8">。</span>';

quotes[27] = '<span class="span1">在</span><span class="span2">有</span><span class="span3">生</span><span class="span4">之</span><span class="span5">年</span><span class="span6">遇</span><span class="span7">見</span><span class="span8">你</span><span class="span9">,</span><br><span class="span10">竟</span><span class="span11">花</span><span class="span12">光</span><span class="span13">了</span><span class="span14">我</span><span class="span15">所</span><span class="span16">有</span><span class="span17">的</span><span class="span18">積</span><span class="span19">蓄</span><span class="span20">。</span>';

quotes[28] = '<span class="span1">多</span><span class="span2">照</span><span class="span3">照</span><span class="span4">鏡</span><span class="span5">子</span><span class="span6">,</span><br><span class="span7">很</span><span class="span8">多</span><span class="span9">事</span><span class="span10">情</span><span class="span11">你</span><span class="span12">就</span><span class="span13">明</span><span class="span14">白</span><span class="span15">原</span><span class="span16">因</span><span class="span17">了</span><span class="span18">。</span>';

quotes[29] = '<span class="span1">我</span><span class="span2">喜</span><span class="span3">歡</span><span class="span4">你</span><span class="span5">,</span><span class="span6">從</span><span class="span7">一</span><span class="span8">而</span><span class="span9">終</span><span class="span10">,</span><span class="span11">認</span><span class="span12">真</span><span class="span13">且</span><span class="span14">慫</span><span class="span15">。</span>';

quotes[30] = '<span class="span1">別</span><span class="span2">再</span><span class="span3">說</span><span class="span4">自</span><span class="span5">己</span><span class="span6">是</span><span class="span7">單</span><span class="span8">身</span><span class="span9">狗</span><span class="span10">了</span><span class="span11">,</span><span class="span12">你</span><span class="span13">這</span><span class="span14">個</span><span class="span15">年</span><span class="span16">紀</span><span class="span17">狗</span><span class="span18">都</span><span class="span19">死</span><span class="span20">了</span><span class="span21">。</span>';

quotes[31] = '<span class="span1">「</span><span class="span2">用</span><span class="span3">兩</span><span class="span4">個</span><span class="span5">字</span><span class="span6">形</span><span class="span7">容</span><span class="span8">你</span><span class="span9">的</span><span class="span10">罩</span><span class="span11">杯</span><span class="span12">」</span><span class="span13">「</span><span class="span14">隨</span><span class="span15">爹</span><span class="span16">」</span>';

quotes[32] = '<span class="span1">氣</span><span class="span2">質</span><span class="span3">永</span><span class="span4">遠</span><span class="span5">都</span><span class="span6">是</span><span class="span7">無</span><span class="span8">法</span><span class="span9">估</span><span class="span10">價</span><span class="span11">的</span><span class="span12">,</span><span class="span13">不</span><span class="span14">然</span><span class="span15">我</span><span class="span16">早</span><span class="span17">就</span><span class="span18">身</span><span class="span19">價</span><span class="span20">百</span><span class="span21">萬</span><span class="span22">了</span><span class="span23">。</span>';

quotes[33] = '<span class="span1">你</span><span class="span2">這</span><span class="span3">人</span><span class="span4">沒</span><span class="span5">啥</span><span class="span6">特</span><span class="span7">出</span><span class="span8">衆</span><span class="span9">,</span><span class="span10">就</span><span class="span11">是</span><span class="span12">臉</span><span class="span13">皮</span><span class="span14">夠</span><span class="span15">堅</span><span class="span16">固</span><span class="span17">。</span>';

quotes[34] = '<span class="span1">我</span><span class="span2">要</span><span class="span3">吃</span><span class="span4">胖</span><span class="span5">點</span><span class="span6">,</span><span class="span7">這</span><span class="span8">個</span><span class="span9">冬</span><span class="span10">天</span><span class="span11">才</span><span class="span12">不</span><span class="span13">會</span><span class="span14">感</span><span class="span15">覺</span><span class="span16">冷</span><span class="span17">。</span>';

quotes[35] = '<span class="span1">一</span><span class="span2">直</span><span class="span3">非</span><span class="span4">常</span><span class="span5">羨</span><span class="span6">慕</span><span class="span7">我</span><span class="span8">的</span><span class="span9">男</span><span class="span10">朋</span><span class="span11">友</span><span class="span12">,</span><span class="span13">他</span><span class="span14">有</span><span class="span15">一</span><span class="span16">個</span><span class="span17">世</span><span class="span18">界</span><span class="span19">上</span><span class="span20">最</span><span class="span21">好</span><span class="span22">的</span><span class="span23">女</span><span class="span24">朋</span><span class="span25">友</span><span class="span26">。</span>';

quotes[36] = '<span class="span1">如</span><span class="span2">果</span><span class="span3">白</span><span class="span4">癡</span><span class="span5">會</span><span class="span6">飛</span><span class="span7">,</span><span class="span8">那</span><span class="span9">我</span><span class="span10">身</span><span class="span11">邊</span><span class="span12">簡</span><span class="span13">直</span><span class="span14">是</span><span class="span15">個</span><span class="span16">飛</span><span class="span17">機</span><span class="span18">場</span><span class="span19">。</span>';

quotes[37] = '<span class="span1">別</span><span class="span2">人</span><span class="span3">笑</span><span class="span4">起</span><span class="span5">來</span><span class="span6">很</span><span class="span7">好</span><span class="span8">看</span><span class="span9">,</span><span class="span10">但</span><span class="span11">你</span><span class="span12">不</span><span class="span13">一</span><span class="span14">樣</span><span class="span15">,</span><span class="span16">你</span><span class="span17">是</span><span class="span18">看</span><span class="span19">起</span><span class="span20">來</span><span class="span21">很</span><span class="span22">好</span><span class="span23">笑</span><span class="span24">。</span>';

quotes[38] = '<span class="span1">只</span><span class="span2">是</span><span class="span3">因</span><span class="span4">爲</span><span class="span5">在</span><span class="span6">人</span><span class="span7">羣</span><span class="span8">中</span><span class="span9">多</span><span class="span10">看</span><span class="span11">了</span><span class="span12">你</span><span class="span13">一</span><span class="span14">眼</span><span class="span15">,</span><span class="span16">就</span><span class="span17">不</span><span class="span18">想</span><span class="span19">再</span><span class="span20">看</span><span class="span21">第</span><span class="span22">二</span><span class="span23">眼</span><span class="span24">。</span>';

quotes[39] = '<span class="span1">我</span><span class="span2">們</span><span class="span3">不</span><span class="span4">要</span><span class="span5">再</span><span class="span6">見</span><span class="span7">面</span><span class="span8">了</span><span class="span9">,</span><span class="span10">洗</span><span class="span11">頭</span><span class="span12">好</span><span class="span13">累</span><span class="span14">,</span><span class="span15">洗</span><span class="span16">發</span><span class="span17">水</span><span class="span18">好</span><span class="span19">貴</span><span class="span20">。</span>';

var quote = quotes[rand1];
$("#content-desc").html(quote);


</script>
<script>
    var clipboard = new Clipboard('.btn', {
        text: function() {
            return $("#content-desc").text();
        }
    });

    clipboard.on('success', function(e) {
        alert("複製成功");
    });

    clipboard.on('error', function(e) {
        alert("複製失敗");
    });
    $(".jump").click(function(){
        window.location.href=$(".weburl").val();
    })
    </script>


</body></html>

實現原理:建立下標爲0-39的數組用來存儲不一樣html段落,而後運用var rand1 = parseInt(Math.random()*40);隨機數來獲得0-40的下標,最後獲取指定數組的值,將html段落添加到指定位置var quote = quotes[rand1];$("#content-desc").html(quote); Game Over..程序員

複製功能,運用了<script src="http://css.0826.cc/w/clipboard.min.js"></script>插件,這個是將文本複製到剪貼板的插件web

相關文章
相關標籤/搜索