如果我想链接使用jquery或javascript的按钮的点击两个内部页面怎么办... 我可以在HTML中使用<a href=#nextPage">
但我想要一个脚本来做到这一点!我现在正在做的是:如何链接Jquery mobile中的内部页面?
<!-- first page-->
<div data-role="page" id="firstPage">
<div data-role="header">
<h1>Test page</h1>
</div>
<div data-role="content">
<p>this page will link internal pages using # </p>
<a href="#nextPage" data-role="button">change to next page</a>
</div>
</div>
<!-- second page-->
<div data-role="page" id="nextPage">
<div data-role="header">
<h1>Test page 2 </h1>
</div>
<div data-role="content">
<p>this page will appear after you click the button on first page. </p>
</div>
</div>
这是做得很好,但我需要的是脚本来链接它们。因为在我的应用程序中,我只需要在某些条件满足的情况下点击按钮来更改页面。但我不知道该怎么办...
-----------编辑------------ 我找到了一个方法 window.location。 href =“#nextPage” 这是如何完成的。 感谢所有为你的努力..
您可以添加'onclick'事件,甚至更好的(?),你可以附加'.click'事件。 – nhahtdh 2012-07-23 04:07:42
我正在做我的真实应用程序。但如何更改页面? – priyankirk 2012-07-23 04:09:32
使用'$ .mobile.changePage' - 查看我的答案。 – nhahtdh 2012-07-23 04:18:33