如果是输入的话就用onkeyup="alert(this.value)"
//alert(this.value)这个换成你要执行的代码

解决方案 »

  1.   

    to vicy
    不一定是输入,可能是扫描得到的值,你说的这个是在哪里写,是脚本里还是代码里 ,能稍微详细点吗,给个例子
    ,拜托了,谢谢了,急啊
      

  2.   

    onpropertychange这个好象只ie适用.
      

  3.   


    <html>
    <head>
    <script>
    function changeprop()
    {
        oprop.value = sText.value;
    }
    function changeCSSprop()
    {
        if(oSelect.selectedIndex==0) 
            oStyleprop.style.color= "white";
        else 
            oStyleprop.style.color = "black";
        oStyleprop.style.backgroundColor = oSelect.value;
    }
    function Results()
    {
        sSrc.innerText = event.srcElement.id;
        sproperty.innerText = event.propertyName;
    }
    </script>
    </head>
    <body>
    <div style="background:#eeeeee; padding:10px;">Click the button below to change
    its 'Value' property to the string specified in the text box.<br><br>
    <input type="text"  style="width:250px" id="sText" value="Enter Some Text"></input>
    <input type=button id="oprop" onclick="changeprop()" value="Change property" onpropertychange="Results();"></p>
    <p>Click the button below to change its 'backgroundColor' Cascading Style
    Sheet (CSS) property to the color specified in the drop-down list box.<br>
    <select name="oSelect" style="width:150px">
    <option value="black" style="color:black">Black</option>
    <option value="blue" style="color:blue">Blue</option>
    <option value="green" style="color:green">Green</option>
    <option value="red" style="color:red">Red</option>
    </select>
    <input type=button id="oStyleprop" onclick="changeCSSprop()" value="Change property" onpropertychange="Results();">
    <br><br>
        <div style="border:1px solid #cccccc; width:100%; padding:10px;background:white;">
        <b>Source object:</b> <span id="sSrc" style="color:red;"></span><br>
        <b>property Name:</b> <span id="sproperty" style="color:red;"></span>
        </div>
    </div>
    <br><br>
    </body>
    </html>
      

  4.   

    我想他如果扫描后写入text不知道ff支持不支持.
    万恶的ff啊....如果你是ie用onpropertychange就ok了,如果是ff的话,可以考虑用setInterval来搞,嘿嘿~~for ie
    <input type="text" onpropertychange="alert(this.value)"/>
      

  5.   

    楼上,我用你给我的Html code 试了一下,不是我要的功能,我需要textbox每次变化自动触发,能不能给
    改一下,谢谢
      

  6.   

    IE 用onpropertychange ,FX 用 oninput ,不行就用setInterval()来搞google的自动完成就是setInterval做成的!
      

  7.   

    我用onpropertychange="alert(this.value)" 试了一下,但是我不擅长用Javascript,有什么办法把
    alert(this.value),改什么事件,然后再设计代码(vb.net)中做这个工作,谢谢
      

  8.   

    onpropertychange="eventHandle()"
     
    function eventHandle()
    {} 
      

  9.   

    to mumutiger:<input id="TextBox1" onpropertychange="eventHandle();" type="text" runat="server">
    function eventhandle()
    {   button1.click()
    }
    然后再vb.net 中button1_click()事件中写内容,但我试了好像不行啊?