<script> <br>//Function executed when the status changes<br>function handle( ) <br>{ <br>document.getElementById('msg').innerHTML = document.getElementById('txt').value; <br>} <br><br>//if("v"==" v") only returns true under IE, including IE8 <br>//if(/msie/i.test(navigator.userAgent)) can also effectively determine <br>if("v"=="v" ){ <br>//IE monitors the text box and assigns a function. There cannot be brackets after the function name <br>document.getElementById('txt').onpropertychange = handle; <br>}else{ <br>//Google The browser uses the add event function to add events to the text box and assign the method to be executed. Similarly, brackets cannot be added after the method name <br>document.getElementById('txt').addEventListener("input", handle); <br> } <br></script>
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn