abstract:<!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="发布"> </div> </body> </html>
Correcting teacher:查无此人Correction time:2019-01-11 09:23:15
Teacher's summary:getElementsByName() 这个方法,你的英文打错了。 网页是可以用F12键来调试的,你按下F12,可以看到错误。继续加油