abstract:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>输入字数判断</title>
<script>
var text,number,m;
window.onload=function(){
text=document.getElementById('text');
number = document.getElementById('unmber');
bt=document.getElementById('bt');
text.onkeyup=function aa(){
m=140-text.value.length;
if(m<0){
// 字数成功140
number.style.color="red"
}else{
// 小于140
number.style.color="#888"
}
// 每次输入后修改unmber
unmber.innerHTML=m;
}
// 判断内容是否大于0与小于140
bt.onclick=function(){
if(m=140){
alert('你还没有输入内容');
text.focus()
}else if(m<0){
alert('字数太多了');
text.focus()
}else{
alert('发布成功');
}
}
}
</script>
</head>
<body>
<textarea name="" id="text" cols="30" rows="10"></textarea>
<div><span id='unmber'>140</span>字</div>
<input type="button" id="bt" value="发表"onclick='bt()'>
</body>
</html>
Correcting teacher:查无此人Correction time:2019-06-10 09:44:02
Teacher's summary:完成的不错。每行js和jq语句结束增加;号。继续加油