jQuerymobile-$ .mobile.changepage [英] Jquerymobile - $.mobile.changepage
问题描述
我想从我的.js文件中打开.html文件.因此,我使用了$ .mobile.changePage("file.html").在file.html中有file.js.但是当调用file.html时,不会调用file.js.
I want to open the the .html file from my .js file. So I Used the $.mobile.changePage("file.html"). In the file.html have file.js. But The file.js does not call when the file.html in invoked.
先谢谢.
first.js
$.mobile.changePage ("file.html");
file.html
file.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jQuery Mobile Framework - Dialog Example</title>
<link rel="stylesheet" href="jquery.mobile-1.0a2.min.css" />
<script src="jquery-1.4.4.min.js"></script>
<script src="jquery.mobile-1.0a2.min.js"></script>
<script src="../Scripts/file.js"/> // Could not imported
<script src="../Scripts/helperArrays.js"/> // Could not imported
<script src="../Scripts/globalVariables.js"/> // Could not imported
</head>
<body>
<div data-role="page">
<div data-role="header" data-nobackbtn="true">
<h1>Vaults</h1>
</div>
<!-- <div data-role="content" data-theme="c" id="contentVault">
<a href="Views/searchPage.html" data-role="button" data-theme="b">Sample Vault</a>
<a href="Views/searchPage.html" data-role="button" data-theme="c">My Vault</a>
</div> -->
<div data-role="content" id="content">
<ul id="listview" data-role="listview" data-inset="true" data-theme="e" data-dividertheme="b">
<li id="listdiv" data-role="list-divider">List of Items</li>
</ul>
</div><!-- /content -->
</div>
</body>
</html>
请帮助我.
推荐答案
jQuery mobile通过AJAX获取页面并将其内容添加到当前页面. 我看到了一些有关将页面标题更改为传入标题的通知,因此它们正在(计划中)访问头部,但是目前,当在页面中加载时,jquery mobile似乎并未加载外部js.
Jquery mobile gets pages via AJAX and adds their content to the current page. I saw some notices about changing the page title to the incoming one, so they are (planning?) accessing the head, but at the moment jquery mobile doesn't seem to load external js when loadin a page.
更重要的是-如果您使用$(document).ready(),则它不会被触发,因为它是AJAX
More importantly - if you use $(document).ready() it will not be triggered, because it was AJAX
这篇关于jQuerymobile-$ .mobile.changepage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!