PDA

View Full Version : qt embedded , in webview,refresh code in javascript can't refresh comleted?



zou jacky
22nd December 2010, 16:54
in application for qt embedded , i use webview controler to show a page .the html page will show date time persecond implemented by javascript code, but the page can't refresh completed ,only the up first half can be showed correctly, the down second half keep origin shape. i don't know how to resolve it.
the html page code just like below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>refresh datetime</title>
<style type="text/css">
#clock{
font-size:36px;
color:#0099CC;
}
</style>
<script type="text/javascript">
function nowTime(){
var oNowTime=new Date()
var iMonth=oNowTime.getMonth()
var iDate=oNowTime.getDate()
var iYear=oNowTime.getFullYear()
var iHours=oNowTime.getHours()
var iMinutes=oNowTime.getMinutes()
var iSeconds=oNowTime.getSeconds()
var iMilliSeconds=oNowTime.getMilliseconds()
var sNowTime=iHours+":"+iMinutes+":"+iSeconds;
return sNowTime
}
function nowDate(){
var oNowTime=new Date()
var iMonth=oNowTime.getMonth()+1
var iDate=oNowTime.getDate()
var iYear=oNowTime.getFullYear()
var iHours=oNowTime.getHours()
var iMinutes=oNowTime.getMinutes()
var iSeconds=oNowTime.getSeconds()
var iMilliSeconds=oNowTime.getMilliseconds()
var sNowTime=iYear+"-"+iMonth+"-"+iDate;
return sNowTime
}
function showNowTime(){
var oObjId1=document.getElementById("mdate");
oObjId1.innerHTML=nowDate();
var oObjId2=document.getElementById("mclock");
oObjId2.innerHTML=nowTime();
setTimeout("showNowTime()",1000)
}
</script>
</head>

<body onload="showNowTime()">
<font size="7">
<div id="mdate">mdate</div>
<div id="mclock">mclock</div>
</font>

</body>
</html>

zou jacky
25th December 2010, 03:46
no one .....

zou jacky
14th January 2011, 16:09
please help