<!--块容器开始--> <div class="ub ub-ver uba uc-a1 t-wh "> <div class="ubb b-gra c-m1 uinn uc-t1"> <!--按钮开始--> <div ontouchstart="zy_touch('btn-act',getpageone)" class="btn uba b-bla uinn5 c-blu c-m2 uc-a t-wh ulev1">加载page "two"</div> <!--按钮结束--> </div> <div class="ubb b-gra c-m1 uinn "> <!--按钮开始--> <div ontouchstart="zy_touch('btn-act',getpagetwo)" class="btn uba b-bla uinn5 c-blu c-m2 uc-a t-wh ulev1">加载page "three"</div> <!--按钮结束--> </div> </div> <!--块容器结束-->
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Multi-page template</title> <link rel="stylesheet" href="css/jquery.mobile-1.0.1.min.css" /> <script src="js/jquery.js"></script> <script src="js/jquery.mobile-1.0.1.min.js"></script> </head> <body> <!-- Start of first page: #one --> <div data-role="page" id="one" > <div data-role="header"> <h1>Multi-page</h1> </div><!-- /header --> <div data-role="content" > <h2>Page One</h2> <p><a href="#two" data-role="button" data-transition="slide">加载page "two"</a></p> <p><a href="#three" data-role="button" data-transition="slide">加载page "three"</a></p> </div><!-- /content --> <div data-role="footer" data-theme="d" data-position="fixed"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page one --> <!-- Start of second page: #two --> <div data-role="page" id="two" data-theme="a"> <div data-role="header" data-position="fixed"> <h1>Two</h1> <a href="#one" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a> </div><!-- /header --> <div data-role="content" data-theme="a"> <h2>Hybrid app</h2> </div><!-- /content --> <div data-role="footer" data-position="fixed"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page two --> <!-- Start of three page: #three --> <div data-role="page" id="three" data-theme="a"> <div data-role="header" data-position="fixed"> <h1>three</h1> <a href="#one" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a> </div><!-- /header --> <div data-role="content" data-theme="a"> <h2>异步加载网络数据</h2> <a href="javascript:void(0)" onclick="getdata()" data-role="button" data-mini="true">Ajax get Data</a> <ul data-role="listview" data-inset="true" data-theme="b" data-dividertheme="f"> <li data-role="list-divider">时间</li> <li id="bt">请求开始时间:</li> <li id="et">请求结束时间:</li> </ul> <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f"> <li data-role="list-divider" id="title"></li> <div id="content"></div> </ul> </div><!-- /content --> <script> function getdata(){ var d = new Date().getTime(); document.getElementById("bt").innerHTML = "请求开始时间:"+d; $.getJSON("http://te.3g2win.com/case/?jsoncallback=?",function(data){ var e = new Date().getTime(); document.getElementById("et").innerHTML = "请求结束时间:"+e; document.getElementById("title").innerHTML = data.title; document.getElementById("content").innerHTML = data.content; }); } </script> <div data-role="footer" data-position="fixed"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page three --> </body> </html>
对比
通过这个小demo,我们总结下phonegap和appcan的异同点。