承蒙老师的启发,开始学习jQueryMobile知识。Write less,Do More.做手机web界面,绝对给力。
首先到http://jquerymobile.com/网站下载相应类库,如jquery.mobile-1.0a4.1.zip,jquery-ui-1.8.11.custom.zip。
根据官网上要求,引入相应文件。如图1,代码如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="jquery/jquery.mobile-1.0a4.1.min.css" />
<script src="jquery/jquery-1.5.1.min.js"></script>
<script src="jquery/jquery-ui-1.8.11.custom.min.js"></script>
<script src="jquery/jquery.mobile-1.0a4.1.min.js"></script>
<title>JQueryMobile</title>
</head>
<body>
<div data-role="page"id="home">
<div data-role="header">
<h1>WJGilmore, LLC</h1>
</div>
<div data-role="content">
<strong>Easy PHP Websiteswiththe Zend Framework</strong><br/>
<p>
<em>Easy PHP Websiteswiththe Zend Framework</em>isthe ultimate
introductiontothe popular Zend Framework, covering practical topics
including Doctrine, Zend_Db, Zend_Test, automated deployment,andmuch
more!
</p>
</div>
<div data-role="footer">
<h1>Copyright ©2010W.J. Gilmore, LLC</h1>
</div>
</body>
</html>
jQuery真的很强大啊,通过data-role 属性将可以为我们布局界面。
我是通过Opera Mobile for Windows 模拟器 ,模拟手机浏览器效果。如图2