// A simple Javascript Object/String
var object = "hello";
// Imagine a button in the DOM, and if it's clicked the object value will change
document.getElementById("button").onclick = function(){
window.object = "hello world";
}
// Now I would like to track and do something when the object is changed, ex:
object.onreadystatechange = function(){
alert(object);
}
注:这可能听起来很蠢,因为我能得到在按钮上的onclick
事件的变化,但是这不是我想要的,我要严格跟踪对象的变化本身用于任何类型的用途,上面的代码仅仅是一个例子。跟踪对象是否改变
ahum,不错的把戏:) – Adam 2011-05-10 15:38:24
:-D谢谢你:-) – Neal 2011-05-10 15:39:51