为什么jquery初始化不执行,只有刷新才执行?
<!DOCTYPEhtml><html><head><metacharset="utf-8"><metaname="viewport"content="width=dev...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link type="text/css" rel="stylesheet" href="js/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript" src="js/ajax-getmsg.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.js"></script>
<title>知识点学习</title>
<script type="text/javascript">
function resetheight(){
document.getElementById('zsdfrm').style.height=document.documentElement.clientHeight-document.getElementById('header').offsetHeight-5+'px';
}
$(function(){
var kmstr=window.localStorage.getItem('kmstr');
var njstr=window.localStorage.getItem('njstr');
$('#kmbox').html(kmstr);
$('#njbox').html(njstr);
resetheight();
$('#previewfrm').submit();
});
</script>
</head>
<body>
<div data-role = "header" id="header">
<form id="previewfrm" method="get" action="http://zhengyoukaoshi.cn:88/zhengyoukaoshi/app/preview.php" target="zsdfrm" >
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="10%" align="right">
<a href="index.html"><input type="image" src="img/icons/home.png" class="pic" /></a>
</td>
<td width="80%">
<input type="search" name="keyword" placeholder="知识关键字" />
</td>
<td>
<input type="submit" name="ok" value="搜索" />
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="10%">项目</td>
<td align="left" width="50%" ><span id="kmbox" ></span></td>
<td align="center" >级别<span id="njbox"></span></td>
</tr>
</tbody>
</table>
</form>
<hr >
</div>
<div data-role="content" id="content">
<iframe name="zsdfrm" id="zsdfrm" width="100%" frameborder="0" src="http://zhengyoukaoshi.cn:88/zhengyoukaoshi/app/preview.php" ></iframe>
</div>
</body>
</html>
找到了解决问题的方法:jquery.mobile-1.4.5.min.js前加:
<script type="text/javascript">
$(document).bind('mobileinit',function() {
jQuery.mobile.ajaxEnabled = false;
});
</script> 展开
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link type="text/css" rel="stylesheet" href="js/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript" src="js/ajax-getmsg.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.js"></script>
<title>知识点学习</title>
<script type="text/javascript">
function resetheight(){
document.getElementById('zsdfrm').style.height=document.documentElement.clientHeight-document.getElementById('header').offsetHeight-5+'px';
}
$(function(){
var kmstr=window.localStorage.getItem('kmstr');
var njstr=window.localStorage.getItem('njstr');
$('#kmbox').html(kmstr);
$('#njbox').html(njstr);
resetheight();
$('#previewfrm').submit();
});
</script>
</head>
<body>
<div data-role = "header" id="header">
<form id="previewfrm" method="get" action="http://zhengyoukaoshi.cn:88/zhengyoukaoshi/app/preview.php" target="zsdfrm" >
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="10%" align="right">
<a href="index.html"><input type="image" src="img/icons/home.png" class="pic" /></a>
</td>
<td width="80%">
<input type="search" name="keyword" placeholder="知识关键字" />
</td>
<td>
<input type="submit" name="ok" value="搜索" />
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="10%">项目</td>
<td align="left" width="50%" ><span id="kmbox" ></span></td>
<td align="center" >级别<span id="njbox"></span></td>
</tr>
</tbody>
</table>
</form>
<hr >
</div>
<div data-role="content" id="content">
<iframe name="zsdfrm" id="zsdfrm" width="100%" frameborder="0" src="http://zhengyoukaoshi.cn:88/zhengyoukaoshi/app/preview.php" ></iframe>
</div>
</body>
</html>
找到了解决问题的方法:jquery.mobile-1.4.5.min.js前加:
<script type="text/javascript">
$(document).bind('mobileinit',function() {
jQuery.mobile.ajaxEnabled = false;
});
</script> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询