1

我创建了一个按钮

<a data-role="button">

在弹出窗口中。这是弹出窗口:

<div data-role="popup" id="popupRegister" data-theme="a" data-dismissible="false">
    <div data-role="header" data-theme="b" class="ui-header ui-bar-b" 
             role="banner">
        <h1 class="ui-title" role="heading" aria-level="1">Success!!</h1>
    </div>
    <div data-role="" data-theme="a" class="ui-body-a" 
       role="main" style="padding:15px;">
      <h1>Thank you for regestering with us.</h1>
      <p>You may now continue to the app.</p>

       <!-- this is the button -->
      <a href="#" id="takeMeHome" data-role="button" data-rel="back" 
       data-theme="a" data-inline="true" 
       data-corners="true" data-shadow="true" 
       data-iconshadow="true" data-wrapperels="span" 
       class="ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-up-a">
       <span class="ui-btn-inner"><span class="ui-btn-text">GO</span></span>
      </a>       
     </div>
</div>

当我单击按钮时,console.log正在响应但页面未重定向。为什么?这是我重定向的方式:

$("#takeMeHome").click( function(){
    console.log("lets go home");
    //window.location.href = "home.html";
    //localStorage.registered=true;
    //window.location.replace("home.html");
    window.location.href = ("home.html");
});
4

1 回答 1

3

代替

window.location.href = ("home.html");

$.mobile.changePage('home.html');

并添加data-history="false"到弹出 div。

于 2013-08-27T17:24:18.473 回答