title: Declaring javascript object in a js file.
body: <p>I want to declare a object in a js file like: 
        var o = {p:1};</p>
  
  <p>and then create a watch for it in my html file.</p>
  
  <pre><code>  &lt;script&gt;
  
    var o = {p:1}; 
  
    o.watch("p",function (id, oldval, newval)
    { 
  
  
    alert(newval);
    return newval; 
    }); 
  
    o.p=count;
    &lt;/script&gt;
  </code></pre>
  
  <p>this code works in my html but if I declare "var o' in my js file it does not work. The reason I want to do that is because a I want to modify the value of my object in my js file and detect it in the html.</p>