PDA

View Full Version : Javascript



ale301168
7th September 2008, 00:23
Dear everybody,

I'm using the WebKit demo from Trolltech to test the
Javascript Qt's functionality. My goal is to render HTML
pages with Javascript on my applications and I want
to make some tests with an existing application.

This is the html document I want to load:

<html>
<head>
<script language="javascript">
onerror=handleErr;
function handleErr(msg,url,l)
{
txt="There was an error on this page.\n\n";
txt+="Error: " + msg + "\n";
txt+="URL: " + url + "\n";
txt+="Line: " + l + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
return true;
}
function displayResult()
{
xml=document.implementation.createDocument("","",null);
xml.async=false;
xml.load("file://c:/temp/qresult1.xml");
xsl=document.implementation.createDocument("","",null);
xsl.async=false;
xsl.load("file://c:/temp/qresult.xsl");

xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("showQueryResult").appendChild(resultDocument);
}
</script>
</head>
<body id="showQueryResult" onLoad="displayResult()">
</body>
</html>

The problem is that the Qt's Javascript engine stops after
the execution of the <xml.load("file://c:/temp/qresult1.xml");>
instruction without give me any error message and leaving
the web page blank. The same script run with Firefox !!!

Could you suggest me where I'm wrong or how can I
discover the mistake ?

Thanks

Best regards

/Alessandro