我在我的 jQuery 移动页面中嵌入了 JavaScript,问题是 JavaScript 不能工作,除非你刷新页面。
页面加载后如何使其工作的任何解决方案?
这是我的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.3.1 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=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body,td,th {
font-family: Tahoma, Geneva, sans-serif;
font-size: 12px;
color: #000;
}
</style>
<link href="../jquery-mobile/jquery.mobile.theme-1.0.min.css" rel="stylesheet" type="text/css" />
<link href="../jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css" />
<script src="../jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="../jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
<html>
<head>
</head>
<body>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
//JQuery code for getting current URL
var URL = $(location).attr('href');
$('#mydiv').load('real_news.asp?'+URL);
});
</script>
<div data-role="page" id="try">
<div data-role="header">
<h1>Header</h1>
</div>
<div id="mydiv" data-role="content"></div>
</div>
</body>
</html>
</head>
<body>
</body>
</html>