Home  >  Article  >  Web Front-end  >  When the value of the text box changes, an event is triggered, valid in IE_Form effects

When the value of the text box changes, an event is triggered, valid in IE_Form effects

WBOY
WBOYOriginal
2016-05-16 18:47:031194browse

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> //当状态改变的时候执行的函数 function handle() { document.getElementById('msg').innerHTML = "输入的文字为:" + document.getElementById('txt').value; } if(/msie/i.test(navigator.userAgent)) //ie浏览器 { document.getElementById('txt').onpropertychange = handle; } else {//非ie浏览器,比如Firefox document.getElementById('txt').addEventListener("input", handle, false); document.getElementById('txt').watch('a', fn); } function ff() { document.getElementById('txt').value=Math.random(); } </script>
Statement:
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