我想腳本添加到外部網頁在jQuery Mobile的以外的主文件(其中爲jQuery Mobile的源被稱爲)。這裏是我的代碼這兩個文件添加腳本到外部網頁在jQuery Mobile的以外的home文件
內的index.php
<head>
<title>My Web Application</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="view/css/mobile.css" />
<link rel="stylesheet" href="view/css/reset.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script type="text/javascript" src="view/js/light.js"></script>
</head>
<body>
<div data-role="page" class="page">
<div data-role="header" id="index-header" data-theme="b">
<div id="logo">
<a href="#"><img src="view/images/Milan.png" alt="logo" height="80"></a>
</div>
</div>
<div id="color-bar"></div>
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="b">
<li><a href="#" title="theme"><img src="view/images/1.png" />Security</a></li>
<li><a href="light.php" title="calendar"><img src="view/images/2.png" />Info</a></li>
<li><a href="light.php" title="theme"><img src="view/images/3.png" />Lighting</a></li>
<li><a href="light.php" title="calendar"><img src="view/images/4.png" />Comfort</a></li>
<li><a href="light.php" title="theme"><img src="view/images/5.png" />Music</a></li>
<li><a href="light.php" title="calendar"><img src="view/images/6.png" />Media</a></li>
</ul>
</div><!-- /content -->
</div><!-- /page -->
</body>
這裏的代碼,onclicking我的錨標記,頁面會被重定向到說light.php.In light.php我無法添加任何外部腳本。如果我想使用light.php中的任何腳本,它希望我將它添加到index.php中。但我想加我的腳本中light.php並使其運行light.php是內整合的腳本,我想裏面添加light.php
<script type="text/javascript">
var auto_refresh = setInterval(
function()
{
window.location = "index.php?page=lighting";
}, 1000);
</script>
什麼,當我刷新我的light.php文件,腳本似乎工作,但我想讓它工作沒有刷新。
感謝您的幫助。我嘗試了三種解決方案,它工作得很好。 – raduns
我很高興它正在工作,只是問你是否需要更多。 – Gajotres
是肯定..謝謝.. – raduns