<<<返回

XML+JAVASCRIPT+ASP在线短信息功能(9)
---------下面的文件就是包含WRITEXML函数的WRITEXML.ASP页----------- <% Function WriteXml(Dom,Path,MyID,MyName,DATES,ONLY,Text) On Error Resume Next Dim R
Dom.Load Path
If Dom.parseError.errorCode <> 0 Then
WriteXml = True
Else
Set R = Dom.CreateElement("内容")
With R
.setAttribute "ID",MyID
.setAttribute "NAME",MyName
.setAttribute "DATE",DATES
.setAttribute "ONLY",ONLY
.Text = Text
Dom.documentElement.AppendChild R
End With
Application.Lock
Dom.Save Path
Application.unLock
End If
If Err.number<>0 Then
Err.Clear
WriteXml = True
End If
End Function
%>
-----------------------下面的是一个XMLCODE.JS文件,包含CODE函数----------
function code(Str)
{
var A = new RegExp("‘","gi")
var B = new RegExp("\"","gi")
Str = Str.replace(/&/gi,"&")
Str = Str.replace(/</gi,"<")
Str = Str.replace(/>/gi,">")
Str = Str.replace(A,"'")
Str = Str.replace(B,""")
delete(A)
delete(B)
return(Str)
}
---------------------下面的是一个PACE.JS文件,包含PACE函数------------
// 检查传来的参数是否为空字符串,空返回TRUE,否则返回FALSE
function Pace(Str)
{
var Reg = new RegExp(" ","gi")
Str = Str.replace(Reg,"")
Reg = new RegExp("\r","gi")
Str = Str.replace(Reg,"")
Reg = new RegExp("\n","gi")
Str = Str.replace(Reg,"")
delete(Reg)
if(Str == "")
{
return(true)
}
else
{
return(false)
}
}
-------------------下面是XMLHTTP.JS文件,包含SEND函数---------------
function Send(Str,URL)
{
var Http = new ActiveXObject("Microsoft.XMLHTTP")
var Dom = new ActiveXObject("Microsoft.XMLDOM")
Http.open("POST",URL,false)
Http.send(Str)
Dom.async=false
Dom.loadXML(Http.responseText)
if(Dom.parseError.errorCode != 0)
{
delete(Http)
delete(Dom)
return(false)
}
else
{
var Back = Dom.documentElement.childNodes.item(0).text
delete(Http)
delete(Dom)
return(Back)
}
}