サマリー:工作涉及到前后端,但之前基本是自學(xué),知識(shí)不系統(tǒng),基礎(chǔ)不牢固,之前總是要想半天,單選怎么傳值,復(fù)選怎么傳值,文本域怎么傳值等等,學(xué)完JS這一階段的課之后,發(fā)現(xiàn)其實(shí)都很簡單,基礎(chǔ)掌握牢固了,舉一反三靈活運(yùn)用就可以,JS的一些常用內(nèi)置函數(shù)是死的,需要靈活運(yùn)用,或者根據(jù)自己的需要自定義函數(shù),再來調(diào)用,后面希望能有更深入的學(xué)習(xí)<!doctype html><html> &l
工作涉及到前后端,但之前基本是自學(xué),知識(shí)不系統(tǒng),基礎(chǔ)不牢固,之前總是要想半天,單選怎么傳值,復(fù)選怎么傳值,文本域怎么傳值等等,學(xué)完JS這一階段的課之后,發(fā)現(xiàn)其實(shí)都很簡單,基礎(chǔ)掌握牢固了,舉一反三靈活運(yùn)用就可以,JS的一些常用內(nèi)置函數(shù)是死的,需要靈活運(yùn)用,或者根據(jù)自己的需要自定義函數(shù),再來調(diào)用,后面希望能有更深入的學(xué)習(xí)
<!doctype html>
<html>
<head>
<meta charset="gbk">
<title>微博輸入1作業(yè)</title>
</head>
<style>
body{font-size:12px}
.box{border:8px solid pink;margin:0 auto;width:600px;height:160px;padding:10px}
.box1{float:left;margin-left:300px;font-size:14px;color:#888}
img{float:left}
#text{width:600px;height:100px}
.box #sp1,#sp2,#sp3,#sp4,#sp5,#sp6{float: left;width: 30px;height: 32px;line-height: 32px;padding-left: 26px;}
#sp1{background: url(images/an5.png) no-repeat left center;}
#sp2{background: url(images/an4.png) no-repeat left center;}
#sp3{background: url(images/an3.png) no-repeat left center;}
#sp4{background: url(images/an2.png) no-repeat left center;}
#sp5{background: url(images/an1.png) no-repeat left center;width: 40px;}
#sp6{margin-left: 158px;margin-right:15px;color: #888; }
#bt{float: left;width: 80px;height: 30px;border: none;background: #ffc09f;color: #fff;border-radius: 5px;}
</style>
<script>
var text,number, m
window.onload=function(){
text = document.getElementById('text');
number = document.getElementById('number')
btn = document.getElementById('bt');
text.onkeyup = function sum(){
m = 140-text.value.length;
if(m<0){
number.style.color='red'
}else{
number.style.color='#888'
}
number.innerHTML=m;
}
btn.onclick = function(){
if(m==140){
alert('您還未輸入,請(qǐng)輸入')
}else if(m<0){
alert('字?jǐn)?shù)過多,發(fā)布失敗')
}else{
alert('發(fā)布成功')
}
sum();
}
}
</script>
<body>
<div>
<img src="images/12.png" alt="">
<div>還可以輸入<span id='number'></span>字</div>
<textarea id="text"></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="發(fā)布" id="bt">
</div>
</body>
</html>
添削の先生:韋小寶添削時(shí)間:2018-12-25 09:37:13
先生のまとめ:現(xiàn)在發(fā)現(xiàn)之前感覺復(fù)雜的半天解決不了的都很簡單了吧!這都是正常的!說明是真的認(rèn)真了!