Hello again!.
I am having some troubles trying to use some javascript code inside my app.
I made a widget that is working properly for retrieve data over the web and storing them in the preferences storage record. (But the persistent storage only works in the device, not in the simulator, see my other post for further details).
Now i get another trouble about activating the javascript code without refresh the widget. At the beggining the widget is launched but the styles and the javascript code isn't executing properly, there is an example below to see what i am talking about. WHen i refresh, magically the javascript run ok along with the css load.
This problem is happening only on a device (c3-00 in my case), not in the emulator.

As always, hope anyone can help me.
Grettins and thanks for advance!.

P.D.:Similarly this is happening in an app named "NewsReader.wgt", i can not get it to work unless i refresh.

HTML Code:
    <body onload="javascript:init();">
	<p id ="name"></p>
	<p id = "version"> </p>
    	<input type="button" onclick="getJSON();" value="Get JSON"/><br/>
		<input type="button" onclick="getIt();" value="Get data from preferences"/>
	<div id="test">
var URL_1 = "http://www.geonames.org/postalCodeLookupJSON?postalcode=10504&country=US";

var URL = URL_1;

function init()
	var nameElem    = document.getElementById("name"); 
	var versionElem = document.getElementById("version");
	nameElem.innerHTML    = 'The widgets name is "' + widget.name + 
	                        '". <br>Escaped, the value of name is "' +
	                        escape(widget.name) + '".'; 
	versionElem.innerHTML = 'The widget\'s version is "' + widget.version + 
	                        '". <br> Escaped, the value of version is "' +
	                        escape(widget.version) +'".';

function getJSON()
	var xhr;
	xhr = new XMLHttpRequest();
	xhr.open("GET",URL, false);
	xhr.onreadystatechange = function()
		if (xhr.readyState == 4) 
			if (xhr.status == 200) 
				//document.getElementById('test').innerHTML= "<b>"+ xhr.responseText + "</b><br/>";;
				document.getElementById('test').innerHTML= "<b> GUARDADO </b><br/>";
				document.getElementById('test').innerHTML= "Error code " + xhr.status;

function getIt ()
	document.getElementById('test').innerHTML = widget.preferences.getItem("REG001");