网上很多关于域名查询的源代码,我这里只说多域名查询的问题,网络资源确实丰富,最初的我也下载了不少,每次放到站点上试验,发现最多的情况就是,国际域名查询没问题,但是涉及到国内域名,总是显示网络延迟,连接不上,可能是头一次接触的过,满头雾水,不知道从何下手,看着代码,脑子却不动,一个下午就在茫然中度过。领导也是跟着催促,只好夜里加班,可能是盯的代码时间长了,混熟了,哈哈,一条一条的代码终于读进脑子了,其实自己也不太懂,分析吧,当然分析的可不是代码,而是原作者的想法,为什么注视掉这句,为什么加上那句,几经试验,通过,呵呵,好开心。完全弄完已经早上六点了。下面把源代码贴出来,供大家参考
< %
On Error Resume Next
Server.ScriptTimeOut = 9999999
Function getHTTPPage(jnkcUrl)
Dim CJXMLHTTP
Set CJXMLHTTP = Server.CreateObject( " Microsoft.XMLHTTP " )
CJXMLHTTP.Open " GET " , jnkcUrl, False , "" , ""
CJXMLHTTP.Send
getHTTPPage = CJXMLHTTP.ResponseText
Set CJXMLHTTP = Nothing
End Function
% >
< script language = " JavaScript " >
< ! --
function check()
{
if (form1.dns.value == "" )
{
alert( " 请输入要查询域名 " );
form1.dns.focus();
return false ;
}
if (form1.dns.value.length < 2 )
{
alert( " 域名不能少于三位 " );
form1.dns.focus();
return false ;
}
}
//-->
</ script >
< % if request.Form( " Submit " ) = " 查询 " then % >
< table width = " 450 " border = " 1 " cellpadding = " 3 " cellspacing = " 0 " bordercolor = " B3A177 " bgcolor = " D4EEC9 " class = " tablemar " >
< tr >
< td width = " 444 " height = " 26 " align = " left " valign = " middle " class = " greenwords " >& nbsp; & nbsp; & nbsp;域名查询结果: < br />
< div style = " margin-left:20px " >
< table width = ' 100%' border='0' cellspacing='0' cellpadding='0'>
< %
types = split (request.form( " checkbox " ), " , " ) ' 获取当前选择的类型
dns = trim (request.form( " dns " ))
for i = 0 to ubound (types)
' ext=replace(trim(types(i)),".","")
url = " http://panda.www.net.cn/cgi-bin/check.cgi?area_domain= " & dns & " . " & trim (types(i)) & " "
wstr = getHTTPPage(url)
if instr (wstr, " Domain name is not available " ) > 0 then
mes = " 已被注册 "
elseif instr (wstr, " Domain name is available " ) > 0 then
mes = " 未被注册 <a href='dnsrave.asp'>我要注册</a> "
else
mes = " 网络延迟,请重新查找! "
end if
response.write " <tr><td><b> " & dns & " . " & trim (types(i)) & " </b></td><td><font color='#ff0000'> " & mes & " </font></td></tr> "
next
% ></ table ></ div >
</ td >
</ tr >
</ table >
< % else % >
< form name = " form1 " method = " post " onSubmit = " javascript:return check() " style = " margin:0;padding:0; " >
< table width = " 450 " border = " 1 " cellpadding = " 0 " cellspacing = " 0 " bordercolor = " B3A177 " bgcolor = " D4EEC9 " class = " tablemar " >
< tr >
< td height = " 26 " colspan = " 2 " align = " center " class = " greenwords " >< img src = " images/domain_www.gif " width = " 60 " height = " 18 " />< input name = " dns " type = " text " class = " input_domain " id = " dns " style = " height:16px; width:200px " onMouseOver = " this.style.border='1px solid #00cc33' " onMouseOut = " this.style.border='1px solid #4B82BA' " />
& nbsp;
< input type = " submit " name = " Submit " value = " 查询 " id = " Submit " /></ td >
</ tr >
< tr >
< td width = " 104 " height = " 20 " align = " center " class = " greenwords " > 国际域名 </ td >
< td width = " 340 " height = " 20 " align = " left " valign = " middle " class = " greenwords " >< input type = " checkbox " name = " checkbox " value = " com " id = " checkbox " />
< label for = " checkbox " ></ label >
.com & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;
< input type = " checkbox " name = " checkbox " value = " net " id = " checkbox " />
< label for = " checkbox2 " ></ label >
.net
& nbsp; & nbsp; & nbsp; & nbsp;
< input type = " checkbox " name = " checkbox " value = " org " id = " checkbox " />
< label for = " checkbox3 " ></ label >
.org </ td >
</ tr >
< tr >
< td height = " 20 " align = " center " class = " greenwords " > 国内域名 </ td >
< td height = " 20 " align = " left " class = " greenwords " >< input type = " checkbox " name = " checkbox " value = " com.cn " id = " checkbox " />
< label for = " checkbox4 " > .com.cn
< input type = " checkbox " name = " checkbox " value = " net.cn " id = " checkbox " />
.net.cn
< input type = " checkbox " name = " checkbox " value = " org.cn " id = " checkbox " />
.org.cn
< input type = " checkbox " name = " checkbox " value = " gov.cn " id = " checkbox " />
.gov.cn
< input type = " checkbox " name = " checkbox " value = " cn " id = " checkbox " />
.cn </ label ></ td >
</ tr >
< tr >
< td height = " 20 " align = " center " class = " greenwords " > 新增域名 </ td >
< td height = " 20 " align = " left " class = " greenwords " >< input type = " checkbox " name = " checkbox " value = " info " id = " checkbox " />
< label for = " checkbox9 " ></ label >
.info
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;
< input type = " checkbox " name = " checkbox " value = " biz " id = " checkbox " />
< label for = " checkbox10 " ></ label >
.biz </ td >
</ tr >
< tr >
< td height = " 20 " align = " center " class = " greenwords " > 中文通用域名 </ td >
< td height = " 20 " align = " left " class = " greenwords " >< input type = " checkbox " name = " checkbox " value = " 中国 " id = " checkbox " />
< label for = " checkbox11 " > .中国
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp;
< input type = " checkbox " name = " checkbox " value = " 网络 " id = " checkbox " />
</ label >
.网络 & nbsp; & nbsp; & nbsp; & nbsp;
< input type = " checkbox " name = " checkbox " value = " 公司 " id = " checkbox " />
< label for = " checkbox13 " ></ label >
.公司 </ td >
</ tr >
</ table >
</ form >
< % end if % >