]<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>