Jquerymobile - $.mobile.changepage [英] Jquerymobile - $.mobile.changepage

查看:17
本文介绍了Jquerymobile - $.mobile.changepage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的 .js 文件中打开 .html 文件.所以我使用了 $.mobile.changePage("file.html").在file.html 中有file.js.但是file.js在调用file.html时不会调用.

提前致谢.

first.js

 $.mobile.changePage ("file.html");

文件.html

<头><meta charset="utf-8"/><title>jQuery Mobile Framework - 对话框示例</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"/>//无法导入<script src="../Scripts/helperArrays.js"/>//无法导入<script src="../Scripts/globalVariables.js"/>//无法导入<身体><div data-role="页面"><div data-role="header" data-nobackbtn="true"><h1>保险库</h1>

<!-- <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">我的保险柜</a>

--><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">项目列表</li></div><!--/content -->

请帮帮我..

解决方案

Jquery mobile 通过 AJAX 获取页面并将其内容添加到当前页面.我看到了一些关于将页面标题更改为传入页面的通知,因此他们(计划?)访问头部,但目前 jquery mobile 在加载页面时似乎没有加载外部 js.

更重要的是 - 如果你使用 $(document).ready() 它不会被触发,因为它是 AJAX

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.

THanks in advance.

first.js

 $.mobile.changePage ("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>

Please help me..

解决方案

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.

More importantly - if you use $(document).ready() it will not be triggered, because it was AJAX

这篇关于Jquerymobile - $.mobile.changepage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆