怎樣用ASP實(shí)現(xiàn)郵箱訪問?
您在訪問網(wǎng)站時(shí)是否會(huì)在有些頁(yè)面上見到這種功能---您在可以訪問此網(wǎng)站的同時(shí),還可以查看您免費(fèi)郵箱中是否有新郵件。這個(gè)功能是不是讓您覺得很心動(dòng)、很神秘呢?下面,我就用ASP來舉個(gè)例子讓您知道是如何實(shí)現(xiàn)這一功能的。
首先你可以去一些提供免費(fèi)郵件服務(wù)的站點(diǎn),申請(qǐng)一個(gè)賬號(hào)然后登錄。在打開郵箱時(shí),請(qǐng)您注意地址欄中的內(nèi)容。現(xiàn)在以371為例,你會(huì)發(fā)現(xiàn)其內(nèi)容通常是: http://www.371.net/prog/login?user=fighter&pass=mypassword。
其中"fighter"是您的賬號(hào),"mypassword" 是您的密碼。這時(shí)我們可以從這里得到3個(gè)信息。第1條是我們得到了處理文件的url及文件名:"http://www.371 .net/prog/login";第2條是記錄您賬號(hào)的變量名:user;第3條是記錄您密碼的變量名:pass。我們知道這些信息后,就可著手寫html文件和asp文件了。
'/*Html源文件內(nèi)容如下:*/
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<title>City Club 首頁(yè)</title>
<style type="text/css">
<!--
td { font-size: 9pt}
body { font-size: 9pt}
select { font-size: 9pt}
A {text-decoration: none; color: #003366; font-size: 9pt}
A:hover {text-decoration: underline; color: #FF0000; font-size: 9pt}
-->
</style>
<script language="javascript">
function check(tt) {
if (window.document.form1.selectmail.selectedIndex==0) {
alert("請(qǐng)選擇您的郵箱服務(wù)器!")
window.document.form1.selectmail.focus()
return false
}
if (tt.account.value=="") {
alert("帳號(hào)不能為空!請(qǐng)?zhí)顚憽?quot;)
tt.account.focus()
return false
}
if (tt.account.value.length<3) {
alert("帳號(hào)長(zhǎng)度不能小于3位!請(qǐng)?zhí)顚憽?quot;)
tt.account.focus()
return false
}
if (tt.password.value=="") {
alert("密碼不能為空!請(qǐng)?zhí)顚憽?quot;)
tt.password.focus()
return false
}
if (tt.password.value.length<3) {
alert("密碼長(zhǎng)度不能小于3位!請(qǐng)?zhí)顚憽?quot;)
tt.password.focus()
return false
}
else
return true
}
</script>
<BODY topmargin=12>
<table border=0 bgcolor=d3d3d3>
<td>
<form action="PostOffice.asp" method=post Onsubmit="return check(this)" name=form1
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注