js 新手,求答疑 bug
HTML和JS的代码分别如下程序代码:
<!DOCTYPE HTML> <html> <head> <meta charset=utf-8> <style type="text/css"> #div1{ width: 200px; height: 200px; background-color: red; } </style> </head> <body > <script src="1.js"> </script> <input type="button" value="TYe" onclick="change('yellow')" /> <input type="button" vale="TBlu" onclick="change('blue')" /> <input type="button" value="TBla" onclick="change('black')" /> <div id='div1'>This is a change sample</div> </body> </html> -----------------------------------------以下是1.js代码------------------------------------------ function change (argument) { var oDiv =document.getElementById('div1'); oDiv.style.background=argument; }
但是在浏览器中打开HTML时,第二个button的value值并不显示出来,求解惑