使用jquery mobile导航到多个页面

时间:2014-01-30 06:13:35

标签: jquery jquery-mobile

我一直在使用jquery mobile在页面之间导航。我尝试过以下代码。

<body>
    <div data-role="page" id="home">
        <div data-role="header">
            <h1>site Details</h1>
        </div>
        <div data-role="content">
            <a href="#Site entry1" data-role="button" data-inline="true">Enter the details of site</a>
            <a href="#Modify site" data-role="button" data-inline="true">Modify site details</a>
        </div>
    </div>
    <div data-role="page" id="Site entry1">
        <div data-role="header">
            <a href="#home" data-rel="back" data-role="button" data-icon="home">Home</a>
            <h1>Welcome To enter the details of site</h1>
        </div>
        <div data-role="content">
            <div class="content-primary">
                <form>
                <ul data-role="listview">
                    <li data-role="fieldcontain">
                        <label for="sitename">Site name:</label>
                        <input type="text" sitename="name" id="sitename" value="" />
                    </li>
                    <li data-role="fieldcontain">
                        <label for="siteno">Site name:</label>
                        <input type="text" siteno="siteno" id="siteno" value="" />
                    </li>
                    <a href="#Site entry2" data-role="button" data-inline="true">Next</a>
                </ul>
                </form>
            </div>
        </div>
        <div data-role="page" id="Site entry2">
            <div data-role="header">
                <a href="#Site entry1" data-role="button" data-icon="arrow-l">previous</a>
            </div>
            <div data-role="content">
                <div class="content-primary">
                    <form>
                    <ul data-role="listview">
                        <li data-role="fieldcontain">
                            <label for="moduleno">name:</label>
                            <input type="text" modulename="moduleno" id="moduleno" value="" />
                        </li>
                        <li class="ui-body ui-body-b">
                            <fieldset class="ui-grid-a">
                                <div class="ui-block-b">
                                    <button type="submit" data-theme="a">Submit</button></div>
                            </fieldset>
                        </li>
                    </ul>
                    </form>
                </div>
                <div data-role="footer">
                    <a href="#Site entry3" data-role="button" data-icon="arrow-r">Next</a>
                </div>
            </div>
            <div data-role="page" id="Site entry3">
                <div data-role="header">
                    <a href="#Site entry2" data-rel="back" data-role="button" data-icon="arrow-l">previous</a>
                </div>
                <div data-role="content">
                    <div class="content-primary">
                        <form>
                        <ul data-role="listview">
                            <li data-role="fieldcontain">
                                <label for="modulename">name:</label>
                                <input type="text" name="name" id="name" value="" />
                            </li>
                            <li class="ui-body ui-body-b">
                                <fieldset class="ui-grid-a">
                                    <div class="ui-block-b">
                                        <button type="submit" data-theme="a">Submit</button></div>
                                </fieldset>
                            </li>
                        </ul>
                        </form>
                    </div>
                    <div data-role="footer">
                        <a href="#home" data-role="button" data-icon="home">Home</a>
                    </div>
                </div>
                <div data-role="page" id="Modify site">
                    <div data-role="header">
                        <a href="home" data-rel="back" data-role="button" data-icon="home">Home</a>
                        <h1>List of sites </h1>
                    </div>
                    <div data-role="content"></div>
                    <div data-role="footer"></div>
                </div>
</body>

但我无法从站点入口1页面导航到站点入口2,并从主屏幕中的修改按钮导航到受尊重的页面。我需要将数据从站点入口页面1持久保存到站点入口页面3,直到我按下提交按钮。

提前致谢..

1 个答案:

答案 0 :(得分:0)

<body>
 <div data-role="page" id="home">
<div data-role="header">
<h1>site Details</h1>
</div>

<div data-role="content">

<a href="#Site entry1" data-role="button" data-inline="true">Enter the details of site</a>

<a href="#Modify site" data-role="button" data-inline="true">Modify site details</a>

</div>

 </div>

<div data-role="page" id="Site entry1">

<div data-role="header">
    <a href="#home" data-rel="back" data-role="button" data-icon="home">Home</a>
    <h1>Welcome To enter the details of site</h1>
    </div>


<div data-role="content">
    <div class="content-primary">
    <form>
    <ul data-role="listview">
        <li data-role="fieldcontain">
            <label for="sitename">Site name:</label>
            <input type="text" sitename="name" id="sitename" value=""  />
        </li>
        <li data-role="fieldcontain">
            <label for="siteno">Site name:</label>
            <input type="text" siteno="siteno" id="siteno" value=""  />
        </li>

        <a href="#Site entry2" data-role="button" data-inline="true">Next</a>

    </ul>

    </form>
    </div>


</div>
</div>

<div data-role="page" id="Site entry2">

    <div data-role="header">
    <a href="#Site entry1"  data-role="button" data-icon="arrow-l">previous</a>
    </div>


    <div data-role="content">
        <div class="content-primary">
        <form>
        <ul data-role="listview">
            <li data-role="fieldcontain">
                <label for="moduleno">name:</label>
                <input type="text" modulename="moduleno" id="moduleno" value=""  />
            </li>
            <li class="ui-body ui-body-b">
                <fieldset class="ui-grid-a">
                        <div class="ui-block-b"><button type="submit" data-theme="a">Submit</button></div>
                    </fieldset>
            </li>

        </ul>

        </form>
        </div>
    </div>
    <div data-role="footer">
    <a href="#Site entry3" data-role="button" data-icon="arrow-r">Next</a>
    </div>


</div>

<div data-role="page" id="Site entry3">

    <div data-role="header">
    <a href="#Site entry2" data-rel="back" data-role="button" data-icon="arrow-l">previous</a>
    </div>


    <div data-role="content">
        <div class="content-primary">
        <form>
        <ul data-role="listview">
            <li data-role="fieldcontain">
                <label for="modulename">name:</label>
                <input type="text" name="name" id="name" value=""  />
            </li>

            <li class="ui-body ui-body-b">
                <fieldset class="ui-grid-a">
                        <div class="ui-block-b"><button type="submit" data-theme="a">Submit</button></div>
                    </fieldset>
            </li>

        </ul>

        </form>
        </div>
    </div>
    <div data-role="footer">
    <a href="#home"  data-role="button" data-icon="home">Home</a>
    </div>

</div>

<div data-role="page" id="Modify site">

    <div data-role="header">
    <a href="home" data-rel="back" data-role="button" data-icon="home">Home</a>
    <h1>List of sites </h1>
    </div>

    <div data-role="content">
    </div>

    <div data-role="footer">
    </div>
</div>

 正确的代码