This question already has an answer here:
How to change pages in jQuery Mobile? [duplicate]
                                
                                    (1个答案)
                                
                        
                                2年前关闭。
            
                    
我的代码是这样的:

<div data-role="page" id="LoginPage">

    <div data-role="header">
        <p style="text-align:right;">Welcome</p>
    </div>

    <div data-role="main" class="ui-content">
        <center><img src="taybe.png" style="width:80%; height:80%;" /></center>
        <p style="text-align:right;">ID NUMBER</p>
        <input type="number" id="UserIDTXT"/>
        <p id="IDnote" style="text-align:right;color:red;"></p>
        <p style="text-align:right;">PASS</p>
        <input type="password" id="UserPassTXT"/>
        <p id="Passnote" style="text-align:right;color:red;"></p>
        <table style="width:100%;">
            <tr >
                <td style="width:45%; height:80%;"><input type="button" value="Login" onclick="checkDetails()" /></td>
                <td style="width:45%; height:80%;"><input type="button" value="Visitor" /></td>
            </tr>
        </table>
        <input style="width:100%; height:10%;" type="button" value="Register" />
    </div>

    <div data-role="footer">

    </div>
</div>


这是我要打开的主页,例如,我的ID为1234,密码为123123123

<div data-role="page" id="HomePage">

    <div data-role="header" data-tap-toggle="true" data-theme='b'>
    Here is the homepage
    </div>

</div>


访问checkDetails fucntion中的主页我需要写些什么?

if (($("#UserIDTXT").val() == "3164") && ($("#UserPassTXT").val()) == "12345678")
{
     /*what i need to type here ???*/
}

最佳答案

只是,

 $('#LoginPage').hide(function(){
   $('#HomePage').show();
 })

10-07 23:11