[英]How do I interpret these strange JavaScript timestamps from mobile phones?
[英]Can I update a JavaScript on mobile phones?
我有一個移動網站,我在其中使用JavaScript刷新消息計數器,啟用了JavaScript,但是它不更新計數器。 我正在測試的手機是諾基亞e90。 另一款測試電話是HTC的創新產品,在該產品上效果很好。
e90上的JavaScript版本是否已過時?
這是我的JS:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo TITLE_HOME;?></title>
<meta http-equiv="content-language" content="en" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="include/js/jquery-1.3.2.min.js"></script>
<!-- like this-->
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0b2.min.css" />
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0b2.min.js"></script>
<script>
$(document).ready(function()
{
refresh();
});
function refresh()
{
$.get('newMessageCnt.php', function (cnt) {
$("#msgcntDiv").html("You have " + cnt);
//console.log(cnt);
//$("#msgcntDiv").text("You have " + cnt);
window.setTimeout(refresh,30000);
});
}
</script>
和PHP:
<?php
if ($numOfMessages <> 0)
{
echo "<span class='headings_sub' id='msgcntDiv'>You have " .$numOfMessages . "</span>";
echo "<a class='red_link' href='".ADDRESS."messages.php'> unopened Messages</a>";
}
else
{
echo "<span class='headings_sub'>You have no new messages</span>";
}
?>
HTC $numOfMessages
更新不會閃爍。 在E90上沒有任何反應
Symbian s60v3導航器也基於webkit引擎和javascript引擎。 不確定是問題的根本原因。 給我們您的代碼,它可以幫助您。
嘗試將ID添加到else echo語句中
else {
echo "<span class='headings_sub' id='msgcntDiv'>You have no new messages</span>";
}
如果您以0條消息開頭,那么如果有其他消息出現,您將沒有span ID來更新文本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.