FunctionURLEncoding(vstrIn)
strReturn=""
Fori=1ToLen(vstrIn)
ThisChr=Mid(vStrIn,i,1)
IfAbs(Asc(ThisChr))<&HFFThen
strReturn=strReturn&ThisChr
Else
innerCode=Asc(ThisChr)
IfinnerCode<0Then
innerCode=innerCode+&H10000
EndIf
Hight8=(innerCodeAnd&HFF00)&HFF
Low8=innerCodeAnd&HFF
strReturn=strReturn&"%"&Hex(Hight8)&"%"&Hex(Low8)
EndIf
Next
URLEncoding=strReturn
EndFunction
Functionbytes2BSTR(vIn)
strReturn=""
Fori=1ToLenB(vIn)
ThisCharCode=AscB(MidB(vIn,i,1))
IfThisCharCode<&H80Then
strReturn=strReturn&Chr(ThisCharCode)
Else
NextCharCode=AscB(MidB(vIn,i+1,1))
strReturn=strReturn&Chr(CLng(ThisCharCode)*&H100+CInt(NextCharCode))
i=i+1
EndIf
Next
bytes2BSTR=strReturn
EndFunction
dimstrA,oReq
strA=URLEncoding("submit1=Submit&text1=中文")
setoReq=CreateObject("MSXML2.XMLHTTP")
oReq.open"POST","http://ServerName/VDir/TstResult.asp",false
oReq.setRequestHeader"Content-Length",Len(strA)
oReq.setRequestHeader"CONTENT-TYPE","application/x-www-form-urlencoded"
oReq.sendstrA
msgboxbytes2BSTR(oReq.responseBody)
//readyState是xmlhttp返回数据的进度,0=载入中,1=未初始化,2=已载入,3=运行中,4=完成
//组件是否安装
isComponentInstalled("{6B053A4B-A7EC-4D3D-4567-B8FF8A1A5739}","componentID"))
//检查网页是否存在
functionCheckURL(URL)
{
varxmlhttp=newActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("GET",URL,false);
try
{
xmlhttp.Send();
varresult=xmlhttp.status;
}
catch(e){return(false);}
if(result==200)
{
returntrue;
}
xmlhttp=null;
returnfalse;
}
//连接数据库
//用JavaScript写服务器端连接数据库的代码示例
varconn=newActiveXObject("ADODB.Connection");
conn.Open("Provider=SQLOLEDB.1;DataSource=localhost;UserID=sa;"
+"Password=;InitialCatalog=pubs");
varrs=newActiveXObject("ADODB.Recordset");
varsql="select*fromauthors";
rs.open(sql,conn);
shtml="
shtml+="au_id au_lname au_fname phone address city state zip ";
while(!rs.EOF)
{
shtml+=" "; "+rs("au_id")+" "+rs("au_lname")+" "+rs("au_fname")+" "+rs("phone")+" "+rs("address")+" "+rs("city")+" "+rs("state")+" "+rs("zip")+"
rs.moveNext;
}
shtml+="";
document.write(shtml);
rs.close();
rs=null;
conn.close();
conn=null;
//使用数据岛
srno:
times:
//获得参数
//可编辑SELECT
select>