<script language="vbscript"> Sub submit1_onmouseup '當點擊“查詢”按鈕時觸發(fā); Dim objXML, objXSL, objFSO,strFile, strFileName, strXSL,strURL,TheForm Set TheForm = Document.wordfind window.status="正在檢索數(shù)據(jù)···" strURL="dns.asp" Set objXML = CreateObject("Microsoft.XMLHTTP") '創(chuàng)建MS的XMLHTTP組件; stra = "submit=submitfqdn="TheForm.words.value objXML.Open "post",strURL,false '采用Post提交方式; objXML.setrequestheader "content-length",len(stra) objXML.setrequestheader "content-type","application/x-www-form-urlencoded" objXML.send stra ' 發(fā)送信息 xmlGet = objXML.responseText '稍等片刻后,得到服務(wù)器端傳回來的結(jié)果; if instr(1,xmlGet,"This is not a valid .com .net .org .info or .biz domain name",1)<1 and len(trim(xmlGet))>100 then if instr(1,xmlGet,"This domain is available",1)<1 then if instr(1,xmlGet,"Registrant:",1) then strFind1 =instr(1,xmlGet,"Registrant:",1) else strFind1 = instr(1,xmlGet,"<pre><FONT face=""Verdana, Arial",1)+65
strFind2 = instr(1,xmlGet,"</FONT></pre>",1) strFind4=strFind2-strFind1 sHTML = mid(xmlGet,strFind1,strFind4) TheForm.comments.value="查詢結(jié)果:"+chr(13)+chr(10)+sHTML window.status="查詢結(jié)果:該域名已被占用" else TheForm.comments.value="恭喜你,此域名可用!" window.status="查詢結(jié)果:該域名仍然處于可用狀態(tài)!" end if else TheForm.comments.value= "無效的國際頂級域名!請輸入以(.com .net .org .info or .biz)結(jié)尾的國際域名, 例如sun.com" window.status="無效的國際頂級域名!請輸入以(.com .net .org .info or .biz)結(jié)尾的國際域名, 例如CCTV.com" end if Set objXML = Nothing end sub </script>
<html><head><title>XMLHTTP之域名查詢篇</title></head> <body bgColor=#cccca3> <form method="post" name=wordfind onsubmit="javascript:return false"> 請輸入域名名稱:<input type="text" value="cctv.com" name="words" size="69"> <input type="submit" value="查詢" id=Submit1 name=Submit1> <TEXTAREA name=comments readonly rows=10 cols=76></TEXTAREA> </form></body></html>
|