我可以在手机上更新JavaScript吗?
我有一个移动站点,我正在使用JavaScript刷新消息计数器,JavaScript已启用,但它不会更新计数器。我正在测试的手机是诺基亚e90。另一款测试手机是HTC的创新产品,在那里工作得非常完美 e90上的JavaScript版本是否过时 这是我的JS:我可以在手机上更新JavaScript吗?,javascript,mobile,Javascript,Mobile,我有一个移动站点,我正在使用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"> &l
<!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>
$(文档).ready(函数()
{
刷新();
});
函数刷新()
{
$.get('newMessageCnt.php',函数(cnt){
$(“#msgcntDiv”).html(“您有”+cnt);
//控制台日志(cnt);
//$(“#msgcntDiv”).text(“您有”+cnt);
设置超时(刷新,30000);
});
}
而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>";
}
?>
Symbian s60v3 navigator也基于webkit引擎和javascript引擎。
不确定是否是问题的根本原因。请提供您的代码,这会有所帮助。尝试将id添加到else echo语句中
else {
echo "<span class='headings_sub' id='msgcntDiv'>You have no new messages</span>";
}
else{
回显“您没有新消息”;
}
如果您从0条消息开始,那么如果有其他消息,您将没有span id来更新文本。您使用jQuery还是jQuery mobile?哪个版本?是的,我在我的目录中看到了:jquery.mobile-1.0b2如何更改顶部的代码,然后将其包括在内?谢谢下次请利用你的I's