<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>onproperychange和onChange方法</title> <script> function changeFunction(){ document.getElementById("textfield2").readOnly=true ; } </script> </head> <body> <br> <input type="text" name="textfield" value="请输入" onpropertychange="document.getElementById('webtest').innerHTML=this.value;" /> <div>您输入的值为:<span id="webtest">还未输入</span></div> <input type="text" name="textfield1" value="请输入" onChange="changeFunction()" /> <input type="text" id="textfield2" name="textfield2" value="默认值" /> <br /> <br> </body> </html>
?