微博输入框一无图版 完整

Original 2018-11-29 21:40:19 252
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>微博输入框一无图版 完整</title><style type="text/css">.weibo{width: 600px;height: 150px;borde

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>微博输入框一无图版 完整</title>

<style type="text/css">

.weibo{width: 600px;height: 150px;border: 10px solid pink; margin: 0px auto; padding: 10px;}

.tu1{float: left;width: 180px;height: 24px; color: blue; padding-left: 15px;}

.weibo1{float: left;width: 120px; height: 24px;margin-left: 250px; text-align: right; font-size: 14px;color: #888;}

.weibo1 span{font-size: 16px;font-weight: bold;}

#text{width: 595px;height: 100px; border: 1px solid #888;}

#sp1,#sp2,#sp3,#sp4,#sp5,#sp6{float: left;width: 30px;height: 32px;line-height: 32px;padding-left: 26px; font-size: 14px;}

#sp5{width: 50px;}

#sp6{margin-left: 150px;}

#bt{float: right;width: 80px;height: 25px;border: none;background: #ffc09f;color: #fff;border-radius: 5px;}

</style>

<script type="text/javascript">

var text,number,zishu;

window.onload=function () {

text=document.getElementById('text');

number=document.getElementById('number');

bt=document.getElementById('bt');

text.onkeyup=function aa() {

m=140-text.value.length;//微博限制字数140字

if(m<0){

number.style.color="red";

            }else{

             number.style.color="#888";

            }

            number.innerHTML=m;

            }

bt.onclick=function () {

if(m==140){

alert("你还没有输入");

text.focus();

}else if(m<0){

alert("字数太多了,不能发布");

text.focus();

}else{

alert("发布成功");

}

}

aa();

}

</script>


</head>

<body>

<div>

<span>有什么新鲜事告诉大家?</span>

<div>还可以输入<span id="number"></span>字</div>

<textarea id="text"></textarea>

<span id="sp1">表情</span>

<span id="sp2">图片</span>

<span id="sp3">视频</span>

    <span id="sp4">话题</span>

    <span id="sp5">长微博</span>

    <span id="sp6">公开</span>

    <input type="button" value="发布" id="bt">




</div>


</body>

</html>


Correcting teacher:灭绝师太Correction time:2018-11-30 09:21:06
Teacher's summary:完全跟老师差不多奥,老师出错你也出错,其中,老师给匿名函数命名还调用了这一步是错的,你就照抄啦!把aa()这个函数去掉

Release Notes

Popular Entries