wap1.2和wap2.0的比較

wap1.2版本:
一、擡頭:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_2.1.xml">
<% response.setContentType("text/vnd.wap.wml;charset=UTF-8");%>
<% request.setCharacterEncoding("UTF-8");%>
<%@ page contentType="text/vnd.wap.wml; charset=GB2312" %>

wap2.0版本:
基本上和html語言同樣,只是介於部分手機不支持一些標籤,因此咱們的頁面書寫有所限制,而且不能用js語言
2.0不能實現的功能可使用wap1.2頁面代替
一、擡頭
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<%@ page contentType="application/vnd.wap.xhtml+xml;charset=gb2312" %>
<% response.setContentType("application/xhtml+xml;charset=UTF-8");%>
<% request.setCharacterEncoding("UTF-8");%>

MyEclipse中擡頭的寫法
WAP1.2
<%@ page contentType="text/vnd.wap.wml; charset=GB2312" %><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<% response.setContentType("text/vnd.wap.wml;charset=UTF-8");%>
<% request.setCharacterEncoding("UTF-8");%>
<wml>
<head>
         <meta http-equiv="Cache-Control" content="max-age=0" forua="true" />
         <meta http-equiv="Cache-Control" content="no-cache" />
         <meta http-equiv="Cache-Control" content="must-revalidate"/>
</head>

WAP2.0
<%@ page language="java" contentType="application/vnd.wap.xhtml+xml;charset=gb2312"%>
<% response.setContentType("application/xhtml+xml;charset=utf-8");%>
<% request.setCharacterEncoding("utf-8");%>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml;charset=UTF-8" />
        <link rel="stylesheet" href="jspx/style.css" type="text/css" />
        <title>wap搜索</title>
     </head>
-----------------------------------------------------------------------------------------------------------

wap1.2版本:
二、<wml></wml>至關於html中的<html></html>,全部的內容都在其中
<card></card>至關於html中的<body></body>,可是一個wml中能夠有多個card,主體內容必定要包括在card中
<p></p>和html中的同樣
一般格式爲:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_2.1.xml">
<% response.setContentType("text/vnd.wap.wml;charset=UTF-8");%>
<% request.setCharacterEncoding("UTF-8");%>
<%@ page contentType="text/vnd.wap.wml; charset=GB2312" %>
<wml>
<card>
<p>
…………
…………
</p>
</card>
</wml>

wap2.0版本:
二、在<html>中必定要寫成:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>和標準的html類似:
<head>
          <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml;charset= UTF-8" />
          <link rel="stylesheet" href="cssurl" type="text/css" />    
          <title>titlename</title>
</head>
<body></body>,<p></p>和標準的同樣,可是除了<form>之外,全部的內容都要在<p></p>中,對於<form>,格式爲
<form><p></p></form>
一般的頁面格式爲:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<%@ page contentType="application/vnd.wap.xhtml+xml;charset=gb2312" %>
<% response.setContentType("application/xhtml+xml;charset=UTF-8");%>
<% request.setCharacterEncoding("UTF-8");%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
          <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml;charset= UTF-8" />
          <link rel="stylesheet" href="cssurl" type="text/css" />    
          <title>titlename</title>
</head>
<body>
<p>
…………
…………
</p>
<form>
<p>
…………
…………
</p>
</form>
</body>
</html>
----------------------------------------------------------------------------------------------------------------

wap1.2版本:
三、經常使用標籤:
(1)回車:<br/>

wap2.0版本:
三、經常使用標籤:
(1)回車:<br/>
-------------------------------------------------------------------------------------------------------------------

wap1.2版本:
(2)連接:
<anchor>linkname
<go href="linkurl" method="post">
     <postfield name="fieldname" value="fieldvalue" />
</go>
</anchor>
postfield能夠爲多個,表示要傳遞的參數,必須包括在<anchor></anchor>中,若是沒有傳遞的參數,能夠直接寫成:
<anchor>linkname
<go href="linkurl" method="post"/>
</anchor>

wap2.0版本:
(2)連接:
<a href="linkurl">linkname</a>
--------------------------------------------------------------------------------------------------------------------

wap1.2版本:
(3)圖片(聯通爲png格式,移動爲gif格式):
<img src="imageurl" alt="" height="80"/>

wap2.0版本:
(3)圖片(聯通爲png格式,移動爲gif格式):
<img src="imageurl" alt="" height="80"/>
----------------------------------------------------------------------------------------------------------------------

wap1.2版本:
(4)輸入框:
<input name="keywordtext" value="" maxlength="10" title="請輸入關鍵字" emptyok="false"/>
<br/>
<anchor>linkname
<go href="linkurl" method="post">
     <postfield name="postfieldname1" value="postfieldvalue1" />
     <postfield name="postfieldname2" value="$keywordtext" />
</go>
</anchor>
keywordtext爲輸入框的名稱,做爲參數傳遞是要寫成<postfield name="postfieldname2" value="$keywordtext" />的形式
postfieldname1爲一般的參數傳遞
(5)下拉框
<select name="selectname" title="下拉框">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
selectname爲下拉框的名稱,參數傳遞如(4),要寫成<postfield name="postfieldname" value="$selectname" />的形式
(6)多選框
<select name="multiselect" multiple="true">
<option value="value1">view1</option>
<option value="value2">view2</option>
<option value="value3">view3</option>
</select>
multiselect爲多選框的名稱,參數傳遞如(4),要寫成<postfield name="postfieldname" value="$multiselect" />的形式
若是選擇了value1和value2,在後臺接收到的數據爲postfieldname=value1;value2,以此類推

wap2.0版本:
(4)表單:
<form action="linkurl" method="post">
<p>
下面是輸入框:<br/>
<input type="text" name="textname" value="initializevalue"/><br/>
下面是下拉框:<br/>
<select name="selectname">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select><br/>
下面是多選框:<br/>
<input type="checkbox" name="checkbox1" title="hot" value="hot"/>checkboxvalue1&nbsp;
<input type="checkbox" name="checkbox2" title="top" value="top"/>checkboxvalue2&nbsp;
<input type="checkbox" name="checkbox3" title="new" value="new"/>checkboxvalue3<br/>
下面是單選框:<br/>
<input type="radio" name="radiotest" value="hot" checked="checked"/>checkboxvalue1<br/>
<input type="radio" name="radiotest" value="top"/>checkboxvalue2<br/>
<input type="radio" name="radiotest" value="new"/>checkboxvalue3<br/>
下面是隱藏體:<br/>
<input type="hidden" name="hiddenname" value="hiddenvalue"/>
下面是按鈕:<br/>
<input type="submit" value="提交"/>
</p>
</form>
--------------------------------------------------------------------------------------------------------

wap1.2版本:
(7)撥號
直接撥號:<a href="wtai://wp/mc;telnum">telname</a>
telnum:是要撥號的電話,不能有其餘字符,只能是數字;
telname:能夠是任何字符
跳轉撥號:
從任意一個頁面轉到下頁,而後過0.05秒,手機就轉接到要撥打的電話
<card id="eshop-index" ontimer="wtai://wp/mc;telnum">

<timer value="50"/>

</card>

wap2.0版本:
(5)撥號:
<a href="wtai://wp/mc;telnum">telname</a>
telnum:是要撥號的電話,不能有其餘字符,只能是數字;
telname:能夠是任何字符
---------------------------------------------------------------------------------------------------------------------

wap1.2版本:
(8)手機快捷鍵
<do label="viewname" type="accept" name="linkname">
<go href="linkurl" method="post">
</go>
</do>
viewname爲顯示的名稱,linkname爲這個連接的名稱,在同一個頁面中不能夠有重複的linkname,linkurl爲連接url

wap2.0版本:
(6)快捷鍵:
<a href="linkurl" accesskey="telkey">
telkey:爲手機上的鍵名稱,能夠是0、二、三、四、五、六、七、八、九、*、#這12個鍵
只要用戶按鍵不放,就能夠到達linkurl地址
(7)css:
書寫格式和html同樣:
body {color: #000000; font-family: "Arial",

sans-serif; background-color: #E7FAFF;}

.red { color: #ff00ff; }

a:hover span{ color:red; }

.yellow { background-color:#E7FAFF; }
引入:
<link rel="stylesheet" href="cssurl" type="text/css" />
調用:
<span class="red">testtext</span>css

相關文章
相關標籤/搜索