2010-12-22 4 views
5

내 .js 파일에서 .html 파일을 열고 싶습니다. 그래서 나는 $ .mobile.changePage ("file.html")를 사용했다. file.html에는 file.js가 있습니다. 그러나 file.html이 호출 될 때 file.js는 호출하지 않습니다.

미리 알아 두십시오.

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> 

답변

4

JQuery와 모바일 AJAX를 통해 페이지를 얻고 현재 페이지에 콘텐츠를 추가합니다 .. 제발 도와주세요. 페이지 제목을 수신 페이지로 변경하는 것에 대한 몇 가지주의 사항을 보았으므로 헤드에 액세스하고 있습니다 (계획하고 있습니까?)하지만 jquery mobile은 페이지를로드 할 때 외부 js를로드하지 않는 것 같습니다.

더 중요한 것은 - 당신이 .ready $ (문서)를 사용하는 경우()가 트리거되지 않습니다, 그것은 AJAX

때문에
+0

안녕하세요 .. 어떻게 외부 JS를 호출 할 수 있습니다이 훨씬 더 관리 할 수 ​​있습니까? – Finder

+2

jquerymobile 형식으로 JS를 작성해야합니다. 모든 페이지에서 jqm과 같이'