Jquery android多页面中的phonegap

Jquery android多页面中的phonegap,jquery,android,html,cordova,Jquery,Android,Html,Cordova,我是android中phonegap的新用户。我试图创建一个项目,在一个html文件中包含多个页面,但它不起作用。 我使用的代码如下所示 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Page Title</title> <link rel="stylesheet" href="http://code

我是android中phonegap的新用户。我试图创建一个项目,在一个html文件中包含多个页面,但它不起作用。 我使用的代码如下所示

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8" /> 
    <title>Page Title</title> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /> 
    <script src="http://code.jquery.com/jquery-1.5.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script> 
<body> 

<!-- Start of first page --> 
<div data-role="page" id="foo"> 

    <div data-role="header"> 
        <h1>Foo</h1> 
    </div><!-- /header --> 

    <div data-role="content">   
        <h2>Foo</h2> 
        <p>I'm first in the source order so I'm shown as the page.</p>      
        <p>View internal page called <a href="#bar">bar</a></p> 
        <p>View internal page called <a href="#baz" data-rel="dialog" data-transition="pop">baz</a> as a dialog.</p> 
    </div><!-- /content --> 

    <div data-role="footer"> 
        <h4>Page Footer</h4> 
    </div><!-- /footer --> 
</div><!-- /page --> 


<!-- Start of second page --> 
<div data-role="page" id="bar"> 

    <div data-role="header"> 
        <h1>Bar</h1> 
    </div><!-- /header --> 

    <div data-role="content">   
        <h2>Bar</h2> 
        <p>I'm the bar page.</p>        
        <p><a href="#foo" data-direction="reverse">Back to foo</a></p>  
    </div><!-- /content --> 

    <div data-role="footer"> 
        <h4>Page Footer</h4> 
    </div><!-- /footer --> 
</div><!-- /page --> 


<!-- Start of second page --> 
<div data-role="page" id="baz"> 

    <div data-role="header"> 
        <h1>Baz</h1> 
    </div><!-- /header --> 

    <div data-role="content">   
        <h2>Baz</h2> 
        <p>I'm the baz page, viewed as a dialog.</p>        
        <p><a href="#foo" data-rel="back">Back to foo</a></p>   
    </div><!-- /content --> 

    <div data-role="footer"> 
        <h4>Page Footer</h4> 
    </div><!-- /footer --> 
</div><!-- /page --> 

</body> 
</html> 

页面标题
福
福
我是源代码顺序中的第一个,因此显示为页面。

查看名为

以对话框形式查看内部页面。

页脚 酒吧 酒吧 我是酒吧页面。

页脚 巴兹 巴兹 我是baz页面,被视为一个对话框。

页脚

请对此进行调查,我感谢您在这方面提供的任何帮助。

每个页面都需要包含在一个div中,其中包含数据role='page'。对于多个页面,您还应该为每个页面包含一个id

例如


福
我是源代码顺序中的第一个,因此显示为页面。

查看名为

以对话框形式查看内部页面。

页脚
您需要为每个页面创建一个div,该div的数据角色类型=名称为唯一id的页面

此外,所有页面必须使用相同的html文件调用存储

<a href="#page_id">bar</a>



    <div data-role="page" id="foo" data-theme="b">
<div data-role="content">   
    <h2>Foo</h2> 
    <p>I'm first in the source order so I'm shown as the page.</p>      
    <p>View internal page called <a href="#foo2">bar</a></p> 
    <p>View internal page called <a href="#foo2" data-rel="dialog" data-transition="pop">baz</a> as a dialog.</p> 
</div><!-- /content --> 

<div data-role="footer"> 
    <h4>Page Footer</h4> 
</div>



<div data-role="page" id="foo2" data-theme="b">
<div data-role="content">   
    <h2>Foo2</h2> 

</div><!-- /content --> 

<div data-role="footer"> 
    <h4>Page Footer</h4> 
</div>

福
我是源代码顺序中的第一个,因此显示为页面。

查看名为

以对话框形式查看内部页面。

页脚 食物2 页脚
在小提琴上很好用。此外,您的页面布局和jquery移动页面布局似乎也正确


您似乎错过了


添加后,您的代码工作正常。

McDowell是对的,您缺少了
标记

另外,确保您的.js和.css源保存在本地,并且它们的路径是相对的,而不是绝对的

重写为:

<link rel="stylesheet" href="jquery.mobile-1.0a3.min.css" />
<script src="jquery-1.5.min.js"></script>
<script src="jquery.mobile-1.0a3.min.js"></script>


别忘了PhoneGap/Cordova.js

“它不工作”有点模糊,你有什么问题。我也假设jQuery Mobile,尽管你没有这么说。看到整个文档也很好,这样我们就可以发现任何问题。您好,我使用此代码通过一个HTML文件创建多个页面。Bt我的输出仅在一个窗口中显示两个页面。请在这方面帮助我。。。
<link rel="stylesheet" href="jquery.mobile-1.0a3.min.css" />
<script src="jquery-1.5.min.js"></script>
<script src="jquery.mobile-1.0a3.min.js"></script>