onchange与onpropertychange的联系与区别先看这么一段解释:
当一个HTML元素的属性改变的时候,都能通过onpropertychange来捕获。例如一个<input name="text1" id="text1" />对象的value属性被页面的脚本修改的时候,onchange无法捕获到,而onpropertychange却能够捕获。具体理解为:onpropertychange能及时捕获属性值的变化,而onchange在属性值改变时只有通过鼠标执行某些操作才能激活该事件!
如:   [ Copy ] [ Run ] [ Save ]请输入图片地址:<input type="text" name="myface" size="30" value="" onpropertychange="document.images['face'].src=this.value;"><br><br>
<img id="http://www.bolg.cn/face" src="http://www.bolg.cn//img/common/logo.gif" border="" alt="">当text框中的内容被改变时,图片就会立刻被显示出来。而如果用onchange时,改变其值时还需用鼠标单击空白或其他地方才能激活该事件,图片显示才会被改变! 

解决方案 »

  1.   

    Attribute onpropertychange invalid for tag text according to TLD
      

  2.   

    晕,搞定再给100分,我系统用firefox
      

  3.   

    onpropertychange Event  Internet Development Index --------------------------------------------------------------------------------Fires when a property changes on the object.SyntaxInline HTML <ELEMENT onpropertychange = "handler" ... >  All platforms 
    Event property object.onpropertychange = handler JScript only 
    object.onpropertychange = GetRef("handler") Visual Basic Scripting Edition (VBScript) 5.0 or later only 
    Named script <SCRIPT FOR = object EVENT = onpropertychange>  Internet Explorer only 
      

  4.   

    Internet Explorer only
    firefox怎么办啊
      

  5.   

    lz看下面这样可以吗? 
    *************** onkeypress事件+value判断 *********************<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
      <script>
    function resetKwValue()
    {
    var keyword = document.getElementById("keyword").value;

    if(keyword == "查询关键字")
    {
    document.getElementById("keyword").value = "";
    }
    else
    {
    alert("值已改变,触发");
    }
    }
      </script>
    </head><body>
    <input type="text" id="keyword" value="查询关键字" onkeypress="resetKwValue();"/>
    </body>
    </html>
      

  6.   

    javaboy2006(喝着coffee学java) 不行
    dh20156(风之石) ( 两星(中级)) 的方法太复杂了,不实用啊
      

  7.   

    FF 用 oninput
    IE 用 onpropertychange
      

  8.   

    oninput是指输入时间,不包含方法改变值
    text.value="xxxx"扑获不到
      

  9.   

    看来你至少应该给我50分.
    代码:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
    <script>
    var t;
    function changeEvent(eventObj)
    {
    alert(eventObj.value);
    }
    function clickEvent()
    {
    t.value="AAA";
    }
    </script>
     </HEAD>
     <BODY>
    <input type='text' id='_T'  name='_T' value="ttt"
     onChange="..."//正常来说.要使更改的新内容生效,这个方法一定会被调用.在FF中鼠标移开时能触发 ,
     onpropertychange="..."//IE中有用,FF中根本不触发放着也不影响,觉得不好也可以动态加.根据当前浏览器类型
    >
    <input type='button' name='_C' onclick="clickEvent();" value="Click">
     </BODY>
    <script>
    if(null == t)t= document.getElementById('_T');
             //重点是这一句.在FF中能监测到text.value="xxxx"的改变,至于下面function中的三个参数 .实在不知道什么意思.第一个就是watch的对象 ,第二个不懂,第三个为新的值,但是以上代码触发之后值并不会在显示中改变,
    t.watch("value", function(eventObj, xn, newValue) {
    alert(eventObj + "," + xn + "," + newValue);
    alert("newValue:"+newValue);//新的值,但不会更改到显示中.
    alert(t.value);//还会是原来的值.
    });
    </script>
    </HTML>
    自己再去找方法.我要下班了...
    至于的这个要求并不是正常的需求.你只是想在效果中更cool一些.实在找不到办法你的项目并不受影响.
      

  10.   

    watch,ff好像不支持,既然你已经点了按钮不就等于捕获了change事件
      

  11.   

    点按钮触发的事件是:
    function clickEvent()
    {
    t.value="AAA";
    }
    而它只做了一件事情.就是使用引用赋值方式进行改变对象的值,如果你换成t.setAttribute("value","AAA");它也不会触发的.
    以上我帖的代码是我在FF中测试通过的.
    BTW:当你不确定一件事情时候不应该用"好像"这种说法来否定.
      

  12.   

    真是不害意思,对于JavaScript 我只是会用不会写,具体说就是会改写,不会原创。收藏!
      

  13.   

    描述
    Watches for assignment to a property named prop in this object, calling handler(prop, oldval, newval) whenever prop is set and storing the return value in that property. A watchpoint can filter (or nullify) the value assignment, by returning a modified newval (or oldval).If you delete a property for which a watchpoint has been set, that watchpoint does not disappear. If you later recreate the property, the watchpoint is still in effect.To remove a watchpoint, use the unwatch method.The JavaScript debugger has functionality similar to that provided by this method, as well as other debugging options. For information on the debugger, see Getting Started with Netscape JavaScript Debugger.
      

  14.   

    每隔100ms判定text的值是否改变
      

  15.   

    http://zxshx.diy.myrice.com/corea1.htm#1144930
      

  16.   

    ok,请Theface(网络白客) 到
    http://community.csdn.net/Expert/TopicView3.asp?id=5524226
    接分
      

  17.   

    用onchange,给控件赋值后,再调用blur(),触发onchange事件
      

  18.   

    用fireEvent('onchange'),触发事件