// 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