仿163填寫(xiě)郵件地址自動(dòng)顯示下拉(無(wú)優(yōu)化)
2024-05-06 14:16:49
供稿:網(wǎng)友
代碼如下:
<!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=gb2312">
<title>20060427simulate 163</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 150%;
color: #003399;
text-decoration: none;
}
a:link {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 150%;
font-weight: normal;
color: #003399;
text-decoration: none;
}
a:visited {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 150%;
font-weight: normal;
color: #003399;
text-decoration: none;
}
a:hover {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 150%;
color: #0099FF;
text-decoration: underline;
}
a:active {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 150%;
color: #0099FF;
text-decoration: underline;
}
-->
</style>
</head>
<script language="javascript">
/*
author:moonboy
本例中采用onKeyUp事件方可將錄入的數(shù)據(jù)取到。在使用onKeyDown,onKeyPress事件時(shí)只是在錄入第二個(gè)數(shù)據(jù)時(shí)才能取到第一個(gè)數(shù)據(jù)(i don't konw why)。
*/
//var ns = String.fromCharCode(event.keyCode);
function droplist(){
var np= event.keyCode;
if(np==38||np==40){
}
var textv = document.getElementById("drop").value; //取得文本框內(nèi)的值
textv=textv.toLowerCase(); //全部轉(zhuǎn)成小寫(xiě)
var user = new Array();//初始化數(shù)組用來(lái)存儲(chǔ)頁(yè)面列表值的集合
var sortUser = new Array();//排序后的數(shù)組
var resultuser = new Array();//輸出到前臺(tái)的數(shù)組
var vv = document.getElementsByName("hv");//頁(yè)面的值
var vvl= vv.length;//頁(yè)面值的數(shù)組長(zhǎng)度
//付值將從頁(yè)面取到的集合放入user數(shù)組
for(var i=0;i<vvl;i++){
user[i]=vv[i].value;
}
sortUser = user.sort();//對(duì)數(shù)組排序
var rs =new Array();//初始化符合查詢條件的數(shù)組
var temp;
var c=0;//符合條件的數(shù)組計(jì)數(shù)
for(var j=0;j<vvl;j++){
temp=queryWord(textv,sortUser[j]);//調(diào)用queryWord函數(shù),計(jì)算出符合條件的值