现在的位置: 首页 > 综合 > 正文

监测 input 控件中文本的改变

2013年11月04日 ⁄ 综合 ⁄ 共 302字 ⁄ 字号 评论关闭

js 改变 input 值依然会触发事件, 不过,最好将 HTML 控件的输入历史清除,否则,!!!直接选择到输入历史将能够避开文本的监测!!!

关键代码如下:

   if(navigator.userAgent.indexOf("MSIE")>0){
    o.attachEvent("onpropertychange", func1);
   }else if(navigator.userAgent.indexOf("Firefox")>0){
    o.addEventListener("input", func2,false);
   }else if(......){
    o.addEventListener("input",func3,false);
   }

抱歉!评论已关闭.