返回微博输入2-检......登陆

微博输入2-检查字数

2019-03-09 14:55:52281

<!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;}time.png

#sp2{background: url(images/tag.png) no-repeat left center;}tag.png

#sp3{background: url(images/user.png) no-repeat left center;}user.png

#sp4{background: url(images/stopplay.png) no-repeat left center;}stopplay.png

#sp5{background: url(images/toend.png) no-repeat left center;}toend.png

#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="">weibo1.png

<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>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送