亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

微博輸入的js效果

Original 2019-03-10 11:55:02 275
abstrakt:<!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <title>微博輸入</title>     
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>微博輸入</title>
    <style type="text/css">
        #box1{width: 600px;height: 190px;border: 10px solid pink;margin:0 auto;}
        #box2{width: 600px;height: 35px;color: #888897;font-size: 14px;}
        #box2 span{margin-left: 270px;}
        #box2 img{width: 190px;height: 24px;margin-top: 6px;}
        #box3 textarea{width: 550px;height: 100px;padding:10px;margin-left: 13px;}
        #box4{font-size: 12px;}
        #box4 span{width: 50px;height: 20px;display: inline-block;text-align: right;line-height: 20px;}
        #box4 #span1{background: url(images/an5.png) no-repeat ;}
        #box4 #span2{background: url(images/an4.png) no-repeat ;}
        #box4 #span3{background: url(images/an3.png) no-repeat ;}
        #box4 #span4{background: url(images/an2.png) no-repeat ;}
        #box4 #span5{background: url(images/an1.png) no-repeat ;width: 60px;}
        #box4 #span6{margin-left: 150px;}
        #box4 #bt{margin-left: 20px;width: 80px;height: 25px;border: none;background-color: #FFC09F;color: #fff;border-radius: 5px;}
    </style>
    <script type="text/javascript">
        window.onload=function(){
        var number,m,text;
        number = document.getElementById('number');
        text=document.getElementById('text');
        text.onkeyup=function b(){
        m=140-text.value.length;
        if (m<0) {
        number.style.color="red";
        }else{
         number.style.color="#888";
         }
         number.innerHTML=m;
        }
        
        bt.onclick=function(){
         if (m==140) {
         alert("你還沒(méi)有輸入");
         text.focus();
         }else if(m<0){
         alert("字?jǐn)?shù)太多,不可以發(fā)布");
         text.focus();
         }else{
         alert("發(fā)布成功");
         }
         }

    }
    </script>
</head>
<body>
    <div id="box1">
        <div id="box2">
            <img src="images/12.png">
            <span>還可以輸入</span><i id="number"></i>字
        </div>
        <div id="box3">
            <textarea id="text"></textarea>
        </div>
        <div id="box4">
            <span id="span1">表情</span>
            <span id="span2">圖片</span>
            <span id="span3">視屏</span>
            <span id="span4">話(huà)題</span>
            <span id="span5">長(zhǎng)微博</span>
            <span id="span6">公開(kāi)</span>
            <input id="bt" type="submit" value="發(fā)布"">
        </div>
    </div>
</body>
</html>

老師寫(xiě)的代碼中,js中函數(shù)aa已經(jīng)綁定了鍵盤(pán)被松開(kāi)的事件,可以直接觸發(fā)函數(shù),但是老師在后面又調(diào)用了一次函數(shù)aa,結(jié)果瀏覽器出現(xiàn)報(bào)錯(cuò)aa未定義,后來(lái)我刪掉這個(gè)aa函數(shù)的調(diào)用,就沒(méi)有報(bào)錯(cuò)了

Korrigierender Lehrer:韋小寶Korrekturzeit:2019-03-10 13:12:18
Zusammenfassung des Lehrers:寫(xiě)的很不錯(cuò) 老師在寫(xiě)的時(shí)候難免會(huì)出現(xiàn)一些小問(wèn)題 自己發(fā)現(xiàn)要注意自己以后不能犯哦

Versionshinweise

Beliebte Eintr?ge