abstrak:<!DOCTYPE html><html><head><meta charset="utf-8"> <style type="text/css">.box{width:600px;height:180px;border:10px solid #000;margin:0px auto;pa
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
.box{width:600px;height:180px;border:10px solid #000;margin:0px auto;padding:10px;}
.boxa{float:left;margin-left:290px;width:150px;height:20px;text-align:right;font-size:15px;color:#888;}
img{float:left;}
.boxa span{color:green;font-weight:bold;}
#wenben{width:590px;height:100px;border:2px solid #888;margin-top:10px;}
.box #wb1,#wb2,#wb3,#wb4,#wb5,#wb6{float:left;width:40px;height:32px;line-height:32px;padding-left:20px;}
#bt{float:left;width:50px;height:32px;background:#ccc;border:none;color:#fff;border-radius:10px 10px 0px 0px;}
#wb1{background:url(css/wb1.png)no-repeat left center;}
</style>
<title>這是我的選項作業(yè)</title>
<script type ="text/javascript">
var wenben,number,m
window.onload=function(){
wenben=document.getElementById("wenben")
number=document.getElementById("number")
bt=document.getElementById("bt")
wenben.onkeyup=function aa(){
m=140-wenben.value.length
if(m<0){
number.style.color="red"
}else
{number.style.color="green"}
number.innerHTML=m
}
bt.onclick=function(){
if(m==140){alert("您還沒有輸入")
wenben.focus()}
}
else if(m<0){alert("你的字?jǐn)?shù)超過限制")}
else{alert(“發(fā)布成功”)}
}aa()
}
</script>
</head>
<body>
<div class="box">
<img src="css/js.png" width=“200px” height="20px">
<div class="boxa">還可以輸入<span id="number"></span>字</div>
<textarea type="text" id="wenben">
</textarea>
<span id="wb1">英語</span>
<span id="wb2">數(shù)學(xué)</span>
<span id="wb3">語文</span>
<span id="wb4">物理</span>
<span id="wb5">化學(xué)</span>
<span id="wb6">美術(shù)</span>
<input type="button" id="bt" value="發(fā)布">
</div>
</body>
</html>
Guru membetulkan:滅絕師太Masa pembetulan:2019-03-19 09:18:00
Rumusan guru:你這個代碼,提交的時候注意格式,有問題反饋到工單,將你遇到的問題講清楚!