title: BlackBerry webworks weird behavior with JavaScript
body: <p>I am new to BlackBerry development, having developed iPhone apps for years.</p>
  <p>I am trying to do a simple menu like the following, invoked onLoad:</p>
  <pre><code>function initMenus() {
    var item = new blackberry.ui.menu.MenuItem(false, 1, &quot;Save&quot;, saveMe);
    var item2 = new blackberry.ui.menu.MenuItem(false, 2, &quot;Load&quot;, loadMe);
    blackberry.ui.menu.addMenuItem(item);
    blackberry.ui.menu.addMenuItem(item2);
  }
  
  function saveMe()
  {
    localStorage.pixels = window.pageYOffset;
  }
  
  function loadMe()
  {
    window.scrollTo(0, localStorage.pixels);
  }
  </code></pre>
  <p>In the configuration file, I have:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;widget xmlns:rim=&quot;http://www.blackberry.com/ns/widgets&quot; version=&quot;1.0.0&quot; rim:header=&quot;RIM-Widget:rim/widget&quot; xmlns=&quot;http://www.w3.org/ns/widgets&quot;&gt;
    &lt;name&gt;007&lt;/name&gt;
    &lt;description&gt;Sample Application created using the BlackBerry Widget SDK that demonstrates how to use the Menu and MenuItem objects found within the Widget API collection.&lt;/description&gt;
    &lt;author href=&quot;http://na.blackberry.com/eng/developers/browserdev/widgetsdk.jsp&quot; rim:copyright=&quot;2010&quot; email=&quot;astanley@rim.com&quot;&gt;Adam Stanley&lt;/author&gt;
    &lt;content src=&quot;index.html&quot; /&gt;
    &lt;feature id=&quot;blackberry.ui.menu&quot; required=&quot;true&quot; version=&quot;1.0.0.0&quot; /&gt;
    &lt;rim:loadingScreen backgroundColor=&quot;#c0c0c0&quot; /&gt;
    &lt;license href=&quot;&quot; /&gt;
  &lt;/widget&gt;
  </code></pre>
  <p>Having installed the WebWorks last SDK, I can try with emulators of OS5 and OS6 families.</p>
  <p>Now, with OS6 simulators everything is fine. JavaScript functions are properly called.</p>
  <p>With OS5 simulators menu items are shown, but once I click on them, just nothing happens. I tried also with simple alerts, rather than to save and load data in localStorage, but functions are simply not called after clicking menu items.</p>
  <p>What am I doing wrong?</p>
  <p>I am aware that there is a known issue when declaring <code>blackberry.ui.dialog</code> and <code>blackberry.ui.menu</code> in the same application, but I'm just declaring <code>blackberry.ui.menu</code>.</p>