var myInput = document.getElementById('myId');
var lastvalue = myInput.value;
var timerID = setInterval( function() {
if (myInput.value !== lastValue) {
// TODO call your "changed" method here
lastValue = myInput.value;
}
}, 100 );
var myInput = document.getElementById('myId');
var lastvalue = myInput.value;
var timerID = setInterval( function() {
if (myInput.value !== lastValue) {
// TODO call your "changed" method here
lastValue = myInput.value;
}
}, 100 );
What are you watching for that can happen that involves changing the input's value without keystrokes while it has focus? paste by mouse or menu? there might be events for those situations but I'm don't know any offhand.
edits: never mind all that. it looks like ie6 should support cut/copy/paste events on text inputs.
发布评论
评论(3)
并不真地。使用按键并手动检查是否有更改是 IE6 的标准解决方法。
Not really. Using the key press and checking manually if there is a change is the standard workaround for IE6.
尝试使用 click 吧?
Try using click maybe?
启动间隔计时器并轮询输入?
您正在关注什么可能发生的情况,涉及在具有焦点的情况下无需按键即可更改输入的值?通过鼠标或菜单粘贴?可能会有针对这些情况的活动,但我不知道有什么活动。
编辑:别介意这一切。看起来 ie6 应该支持文本输入上的剪切/复制/粘贴事件。
http://www.quirksmode.org/dom/events/cutcopypaste.html
Start an interval timer and poll the input?
What are you watching for that can happen that involves changing the input's value without keystrokes while it has focus? paste by mouse or menu? there might be events for those situations but I'm don't know any offhand.
edits: never mind all that. it looks like ie6 should support cut/copy/paste events on text inputs.
http://www.quirksmode.org/dom/events/cutcopypaste.html