2012-02-20 15 views
2

私はphonegapとjquerymobileを使用してwebappを作成しています。私は他のページに移動しchangePageを使用していた場合、それはworking.Hereは私のコードjquery mobile changePage()が正しく動作しない

<!DOCTYPE HTML> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="viewport" content="width=device-width; user-scalable=no" /> 
<script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script> 
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> 
<link rel="stylesheet" href="jquery.mobile-1.0.1.min.css" /> 
<script type="text/javascript" src="jquery.mobile-1.0.1.min.js"></script> 
</head> 

<script type="text/javascript"> 
function clickEvent() 
{ 
    $.mobile.changePage("account_page.html", null, true, true); 
} 
</script> 
<body> 
<div style="top: 0; left: 0; position: absolute; z-index: 1;"> 
    <img src="images/login_screen.JPG" alt="login_screen" width="320" onclick="clickEvent()"/> 
</div> 
</body> 
</html> 

ではありませんが、私はそれが働いている

window.location.href = 'file:///android_asset/www/account_page.html'; 

を使用する場合...なぜそれはそうでしょうか?

+0

のいずれかを使用する必要がu'llその後、DOMに.htmlの、この概念をクリアするための$ .mobile.changePage( "account_page.html")のみ... – viv

答えて

9

$ .mobile.changePageは別のHTMLを表示しません。それはあなたのリンクuが与えたhtmlのhtmlをスキャンし、最初のjqm 'ページ'を取得してdomに追加します(html全体ではありません)
あなたが意図したものではなく、完全なaccount_pageそれは作品

window.location.href or navigator.app.loadUrl 
+0

おかげghostCoderを試してみてくださいすることができます。.. :) –

+0

優れた説明、ありがとう! – Maxbester

関連する問題