Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 18:47:03
Original
1210 people have browsed it

[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>
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template