?? index1.asp
字號:
?<% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<%Response.ContentType = "text/vnd.wap.wml; charset=utf-8"%>
<?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">
<wml>
<!-- THIS IS THE FIRST CARD IN THE DECK -->
<card title="WAP天氣">
<p>
<img src='http://wap.wapls.com/logo/tq1.gif' alt='logo...'/><br/>
<!--#include file="dx.asp" -->
<%
'-------------對應城市區號---------------------
dim id
id=request.QueryString("id")
%>
<%
Dim Url,Html,start,over,body,wap,wstr,str'定義一些需要使用到的變量
Url="http://news.3g.net.cn/tianqi_detial2.aspx?id="&id&"" ',這是要偷取的網頁地址
wstr=getHTTPPage(url) '獲取指定頁面的全部數據
start=Instr(wstr,"3G天氣預報")+9
'這里設置需要處理的數據的頭部,這個變量應視不同情況而設置,具體內容可以通過查看需要抓取的頁面的源代碼來確定。因為在這個程序里我們需要抓取整個頁面,所以設置為頁面全部抓取。注意,設置的內容必須是頁面內容唯一的,不可以重復。
over=Instr(wstr,"<a href=""tianqi_menu.aspx"">天氣預報首頁</a><br/>")
'和start相對應的就是需要處理的數據的尾部,同樣的,設置的內容必須是頁面中唯一的。
body=mid(wstr,start,over-start)
'------------------------------------------------
body = replace(body,"<p align=""left"">","")'把<p align=""left"">替換成空白
body = replace(body,"<p align=""center"">","")'把<p align=""center"">替換成空白
body = replace(body,"</p>","")'取消<p>
body = replace(body,"<p>","")'取消</p>
body = replace(body,"----------------","----------")'更換----------------
body = replace(body,"~~~~~~~~~~","----------")'更換~~~~~~~~~~
'--------------------------------------------------
Response.write body
%>
<a href="index.asp">[返回上級]</a>
<br/><a href="/index.asp">[網站首頁]</a>
</p>
</card>
</wml>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -