事实上的情况是:
一个产品编号的输入框,用户可以输入编号时可以只输一部分,输完后到数据库里取出完整的编号填回来。
由于以上问题的存在,事实上输入一个产品编号后,blur,到数据库里去取完整编号并对填回来;如果再focus一次,再blur,它又会到数据库里去取一次,这一次显然是多余的。
由于要去数据库,所以用onpropertychange是不现实的

解决方案 »

  1.   

    <input onchange="this.value+=1;return false;">
      

  2.   

    onestab(一刺):做好迎接死循环的准备去测试onproperty,结果却没有死循环
    wsj(骆驼):能不能解释一下。谢谢
      

  3.   

    onpropertychange是一个同步事件..
    处理期间不产生事件嵌套触发
      

  4.   

    yonghengdizhen(爱是永恒):
    事实上存在嵌套触发,不过IE控制了若嵌套触发213(也可能是其它数字,不过差不多就这么多)次,就自行中止。
    所以第一次输入1后,会立即得到200多个1,再输入一个1就得到400多个1……
      

  5.   

    to JK_100001) 
    try <input onchange="this.value+=1;" value=1>2)
    read this:
    This event is fired when the contents are committed and not while the value is changing. For example, on a text box, this event is not fired while the user is typing, but rather when the user commits the change by leaving the text box that has focus. In addition, this event is executed before the code specified by onblur when the control is also losing the focus. 3)
    Think about "committed and not while the value is changing"
      

  6.   

    以另20分做酬再问wsj(骆驼)或其他兄弟姐妹一个问题:
    JK对commit理会不深,能不能实现以下的功能:<input name=a onchange="alert(this.value)" value=hello>
    <input type=button value=ok onclick=test()>
    <script>
    function test()
    {
    //在这里加代码,使得用户在点击按钮时,出现alert信息
    }
    </script>
      

  7.   

    to JK_10000(JK1) 
    没看懂你的要求..
    就是alert('')这么简单吗?
      

  8.   

    另外上面我说的不嵌套触发的事件是onchange.
    而不是onpropertychange
      

  9.   

    yonghengdizhen(爱是永恒):
    谢谢关注,不好意思,没说清楚,我的本意是这样的:
    function test()
    {
    //在这里加代码,触发<input name=a ...>的onchange事件
    }
      

  10.   

    document.all("a").fireEvent("onchange");