大家好我有html文件,div中有各種不同的頁面。現在我想從一個頁面導航到另一個頁面,我正在使用$.mobile.changePage("#test")
,但導航到test.html不會發生。如果我爲test.html使用不同的html文件並將其命名爲$.mobile.changePage(("test.html"));
,則會導航。
我也試過用loadPage,但它也不能解決我的問題。任何建議將不勝感激,提前致謝。
這裏是我的代碼:
<body>
<div data-role="page" id="firstPage" onclick=callSecondPage() class="type-home">
<div data-role="button">
<input type="submit" data-role="button" value="firstPage" id="firstPage">
</div>
<script type="text/javascript">
function callSecondPage()
{
alert ("Inside callPage");
$.mobile.changePage('#secondPage');
}
</script>
</div>
<div data-role="page" id="secondPage" onclick=callThirdPage() class="type-home">
<div data-role="button">
<input type="submit" data-role="button" value="secondPage" id="secondPage">
</div>
<script type="text/javascript">
function callThirdPage()
{
alert ("Inside callPage");
$.mobile.changePage('#thirdPage');
}
</script>
</div>
<div data-role="page" id="thirdPage" onclick=callFourthPage() class="type-home">
<div data-role="button">
<input type="submit" data-role="button" value="thirdPage" id="thirdPage">
</div>
<script type="text/javascript">
function callFourthPage()
{
alert ("Inside callPage");
$.mobile.changePage('#fourthPage');
}
</script>
</div>
<div data-role="page" id="fourthPage" class="type-home">
<div data-role="button">
<input type="submit" data-role="button" value="fourthPage" id="fourthPage">
</div>
</div>
<div data-role="page" id="fifthPage" class="type-home">
<div data-role="button">
<input type="submit" data-role="button" value="fifthPage" id="fifthPage">
</div>
</div>
<div data-role="page" id="sixthPage" class="type-home">
<div data-role="button">
<input type="submit" data-role="button" value="sixthPage" id="sixthPage">
</div>
</div>
之前談到上面的html文件瀏覽其他網頁,而現在$.mobile.changePage('#secondPage');
secondPage沒有從第一頁導航。但是,應用程序的,如果相同的代碼我放在index.html的(即切入點,然後適當的導航發生。
你能爲我們提供用於JQM頁面的HTML嗎? – 2012-08-07 09:19:54