abstract:<!doctype html><html><head><meta charset="UTF-8"><title>微博输入</title><style>body{font-size: 12px;}.box{width: 550px;height: 160px;border:7px solid pi
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>微博输入</title>
<style>
body{font-size: 12px;}
.box{width: 550px;height: 160px;border:7px solid pink;margin: 20px auto;padding: 15px;}
img{float: left;width: 130px;height: 20px;margin-left: 20px;margin-top: 5px;}
.box1{float: left;width: 150px;height: 20px;font-size: 12px;line-height: 20px;margin-top: 8px;margin-left: 230px;}
#number{font-size: 14px;font-weight: bold;}
#text{width: 550px;height: 100px;padding: 5px;}
.box #sp1,#sp2,#sp3,#sp4,#sp5,#sp6{float: left;height:
24px;line-height: 24px;padding: 2px 17px;margin-right: 0px;}
#sp1{background: url(images/time.png) no-repeat left center;}
#sp2{background: url(images/tag.png) no-repeat left center;}
#sp3{background: url(images/user.png) no-repeat left center;}
#sp4{background: url(images/stopplay.png) no-repeat left center;}
#sp5{background: url(images/toend.png) no-repeat left center;}
#sp6{margin-left: 125px;margin-right: 2px;color: #888;}
#anniu{color: #fff;border: none; border-radius: 5px;background: pink;width: 80;height: 26px;}
</style>
<script>
var text,number,m;
window.onload=function(){
text=document.getElementById("text");
number=document.getElementById('number');
anniu=document.getElementById("anniu");
text.onkeyup=function(){
m=140-text.value.length;
if (m<0) {
number.style.color="red";
}else{
number.style.color="#888";
}
number.innerHTML=m;
}
anniu.onclick=function(){
if (m==140) {
alert("你还没有输入。");
text.focus();
}else if(m<0 ){
alert("字数过得,不能发布。");
text.focus();
}else{
alert("发布成功。");
}
}
}
</script>
</head>
<body>
<div>
<img src="images/weibo1.png" alt="">
<div>你还可以输入<span id="number"></span>个字</div>
<textarea name="" id="text" rows="10"></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="anniu">
</div>
</body>
</html>
Correcting teacher:韦小宝Correction time:2019-03-09 15:15:03
Teacher's summary:写的还算是很不错的 等有时间可以通过jQuery来改写一下哦 还可以把jQuery练习练习