abstract:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>微博輸入</title> <style type="text/css"> .inbox{width: 600px;height: 160px;border:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>微博輸入</title>
<style type="text/css">
.inbox{width: 600px;height: 160px;border: 10px pink solid;padding: 10px;margin: 0 auto;}
.inp{float: left;}
.box1{float: left;margin-left: 235px;width: 150px;height: 24px;text-align: right;font-size: 14px;color: #888;}
.box1 span{font-size: 16px;font-weight: bold;}
textarea{width: 600px;height: 100px;border: 1px solid #888;margin-top: 5px;}
.b1{width: 48px;height: 32px;float: left;line-height: 32px;margin-left: 6px;}
#bt{float: left;width: 80px;height: 30px;border: none;background-color: #ffc09f;color: #fff;border-radius: 2px;margin-left: 240px;}
</style>
<script type="text/javascript">
var text,number,m
window.onload=function () {
text=document.getElementById('text')
number=document.getElementById('number')
bt=document.getElementById('bt')
text.onkeyup=function aa(){
m=140-text.value.length
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('發(fā)布成功')
}
}
aa()
}
</script>
</head>
<body>
<div class="inbox">
<div class="inp">有什么新鮮事想告訴大家</div>
<div class="box1">還可以輸入<span id="number"></span>字</div>
<textarea id="text"></textarea>
<span class="b1">表情</span>
<span class="b1">圖片</span>
<span class="b1">視頻</span>
<span class="b1">話題</span>
<span class="b1">長微博</span>
<button id="bt">發(fā)布</button>
</div>
</body>
</html>
Correcting teacher:天蓬老師Correction time:2019-06-11 13:59:52
Teacher's summary:你覺得這樣把代碼一放上來就可以了嗎?
代碼是什么意思, 關(guān)鍵部分一個注釋 不寫, 在實際開發(fā)中, 這都是一些壞習(xí)慣.....