サマリー:<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>blog</title> <style> .box{width: 800px;height: 200px;border: 10px solid
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>blog</title> <style> .box{width: 800px;height: 200px;border: 10px solid purple; margin: 50px auto;padding: 20px;} .box1{float: left;margin-left: 255px;width: 200px;height: 25px;text-align: right;font-size: 20px;color: orange;} /* #text{width: 500px;height: 100px;border: 1px solid gray;margin-top: 6px;*/ .box span {font-size: 18px;font-weight: bold;} } </style> <script> var text1,number,m window.onload=function(){ text1=document.getElementByName('text1') number=document.getElementById('number') bt=document.getElementById('bt') text1.onkeyup=function zf(){ m=140-text1.value.length if(m<0){ number.style.color='red' }else{ number.style.color='#ccc' } number.innerHTML=m } } </script> </head> <body> <div class="box"> <div class="box1">還可以輸入<span id="number">字</span></div> <textarea name="text1" id="text" cols="100" rows="10"></textarea><br> <input type="button" value="發(fā)布"> </div> </body> </html>
添削の先生:查無此人添削時間:2019-01-11 09:23:15
先生のまとめ:getElementsByName() 這個方法,你的英文打錯了。 網(wǎng)頁是可以用F12鍵來調(diào)試的,你按下F12,可以看到錯誤。繼續(xù)加油