JS listens for changes in the value of the text box, and calls the method when it changes
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<meta name= "Auther" content= "Fq"/>
<title> Monitor input box values for immediate change Onpropertychange oninput</title>
<script type= "Text/javascript" >
function immediately () {
var element = document.getElementById ("MyText");
if ("\v" = = "V") {
Element.onpropertychange = WebChange;
}else{
Element.addeventlistener ("Input", webchange,false);
}
function WebChange () {
if (element.value) {document.getElementById ("test"). InnerHTML = Element.value};
}
}
</script>
<body>
<input type= "text" name= "TextField" oninput= "document.getElementById (' webtest '). Innerhtml=this.value;" Onpropertychange= "document.getElementById (' webtest '). Innerhtml=this.value;"/>
<div> The value you entered is: <span id= "webtest" > Not yet entered </span></div>
<br/><br/><br/><br/><br/>
The example written in JS:
<input type= "text" name= "TextField" id= "MyText"/>
<div> The value you entered is: <span id= "Test" > Not yet entered </span></div>
<script type= "Text/javascript" >
Immediately ();
</script>
</body>
This article is from the "Program Ape" blog, please be sure to keep this source http://wxqhome.blog.51cto.com/8768288/1621785
JS monitors the value of text changes, the time when the call method