- ·上一篇文章:运用ASP调用数据库中视图及存储过程
- ·下一篇文章:ASP+SQLServer2000 经验积累
ASP函数库
& vbCrlf
Response.Write "text = text.replace(/<\/?\w+:[^>]*>/gi, '') ;" & vbCrlf
Response.Write "text = text.replace(/ /, ' ' );" & vbCrlf
Response.Write "var re = new RegExp('(<P)([^>]*>.*?)(<\/P>)','gi') ;" & vbCrlf
Response.Write "text = text.replace( re, '<div$2</div>' ) ;" & vbCrlf
Response.Write "return text;" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "function atotxt()" & vbCrlf
Response.Write "{if ( confirm('如果转为文本格式将丢失所有排版内容,请确认是否这样做?')){MZYEDITWINDOW.focus();" & vbCrlf
Response.Write "MZYEDITWINDOW.document.body.innerHTML=HTMLEncode(MZYEDITWINDOW.document.body.innerText);}}" & vbCrlf
Response.Write "function wtohtm()" & vbCrlf
Response.Write "{if ( confirm('是否要将WORD格式去除?')){MZYEDITWINDOW.focus();" & vbCrlf
Response.Write "MZYEDITWINDOW.document.body.innerHTML=cleanword(MZYEDITWINDOW.document.body.innerHTML);}}" & vbCrlf
Response.Write "function CKjtb() {" & vbCrlf
Response.Write "var oDiv = document.getElementById('Temp_HTML');" & vbCrlf
Response.Write "oDiv.innerHTML = '' ;" & vbCrlf
Response.Write "var oTextRange = document.body.createTextRange() ;" & vbCrlf
Response.Write "oTextRange.moveToElementText(oDiv) ;" & vbCrlf
Response.Write "oTextRange.execCommand('Paste') ;" & vbCrlf
Response.Write "var sData = oDiv.innerHTML ;" & vbCrlf
Response.Write "oDiv.innerHTML = '' ;" & vbCrlf
Response.Write "var re = /<\w[^>]* class=""?MsoNormal""?/gi ; var nsData=sData;" & vbCrlf
Response.Write "if ( re.test(sData)){" & vbCrlf
Response.Write "if (confirm( '你要粘贴的内容好象是从Word中拷出来的,是否要先清除Word格式再粘贴?' )){" & vbCrlf
Response.Write "nsData=cleanword(sData) ;" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "MZYEDITWINDOW.document.selection.createRange().pasteHTML(nsData);" & vbCrlf
Response.Write "return false ;" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "setTimeout(""MZYEDITWINDOW.document.body.onpaste =CKjtb;"",1000);" & vbCrlf
Response.Write "</SCRIPT>" & vbCrlf
Response.Write "<!--END 史上最小的在线HTML编辑器,开发者:马政永,版本1.0 网站:http://www.lovemycn.com,本软件为授权使用,如没有马政永授权,任何人或单位不得使用,否则将已侵犯知识产权罪论处!-->" & vbCrlf
End Function
'**************************************************
'函数ID:0039[判断是否奇数]
'函数名:Is_JS
'作 用:判断是否奇数
'参 数:num ---- 要判断的数
'返回值:返回True,否则False
'**************************************************
Public Function Is_JS(ByVal num)
n=num mod 2
if n=1 then
Is_JS=true
else
Is_JS=false
end if
end function
'**************************************************
'函数ID:0040[生成验证码图像BMP]
'函数名:GrapCode
'作 用:生成验证码图像
'参 数:MZYGCstr ---- 要生成的图像的字符
'参 数:Noisy ---- 噪点率(大于0的整数)
'参 数:BkColor ---- 图案背景色(格式:R|G|B)
'参 数:FnColor ---- 字符颜色(格式:R|G|B)
'参 数:NoColor ---- 噪点颜色(格式:R|G|B)
'返回值:验证码图像
'示 例:Response.Write "<img src='" &GrapCode(Request("n"),6,"10|40|100","255|255|255","100|100|100")&"'>"
'**************************************************
Public Function GrapCode(ByVal MZYGCstr,ByVal Noisy,ByVal BkColor,ByVal FnColor,ByVal NoColor)
If Len(Trim(MZYGCstr))>1 Then
Dim imgsize,pimgsize
Const cAmount = 36
Const cCode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim ColorV(2)
tmp=""
tmp=Split(BkColor,"|")
ColorV(0) =""
For i = LBound(tmp) To UBound(tmp)
ColorV(0) = ColorV(0) & ChrB(CInt(tmp(i)))
Next
tmp=""
tmp=Split(FnColor,"|")
ColorV(1) =""
For i = LBound(tmp) To UBound(tmp)
ColorV(1) = ColorV(1) & ChrB(CInt(tmp(i)))
Next
tmp=""
tmp=Split(NoColor,"|")
ColorV(2) =""
For i = LBound(tmp) To UBound(tmp)
ColorV(2) = ColorV(2) & ChrB(CInt(tmp(i)))
Next
imgsize=10*Len(MZYGCstr)*10*24/8
pimgsize=10*Len(MZYGCstr)*10*24/8
If Is_JS(Len(MZYGCstr)) Then
imgsize=imgsize+74
pimgsize=pimgsize+20
Else
imgsize=imgsize+54
End If
imgsize =Hex(imgsize)
pimgsize=Hex(pimgsize)
imgsize =Cstr(imgsize)
pimgsize=Cstr(pimgsize)
'dword对齐处理
Dim length, byteCount,BytePatch
length = Len(MZYGCstr)
byteCount=((length*10*3) mod 4)
If byteCount>0 Then
byteCount= 4 - ((length*10*3) Mod 4)
For i=1 To byteCount : BytePatch = BytePatch & chrB(00) : Next
End If
tmp=""
For i=1 to len(imgsize) step 2
If (i < len(imgsize)) Then
tmp=tmp & Mid(imgsize,i,2) & "|"
Else
tmp=tmp & Mid(imgsize,i,2)
End If
Next
imgsize=StrReverse(tmp)
tmp=""
tmp=Split(imgsize,"|")
imgsize=""
For i = 0 To 3
If (i <= UBound(tmp)) Then
imgsize=imgsize & ChrB("&H"&tmp(i))
Else
imgsize=imgsize & ChrB(0)
End If
Next
ptmp=""
For i=1 to len(pimgsize) step 2
If (i < len(pimgsize)) Then
ptmp=ptmp & Mid(pimgsize,i,2) & "|"
Else
ptmp=ptmp & Mid(pimgsize,i,2)
End If
Next
pimgsize=StrReverse(ptmp)
ptmp=""
ptmp=Split(pimgsize,"|")
pimgsize=""
For i = 0 To 3
If (i <= UBound(ptmp)) Then
pimgsize=pimgsize & ChrB("&H"&ptmp(i))
Else
pimgsize=pimgsize & ChrB(0)
End If
Next
MZYGCstr=UCase(MZYGCstr)
tmp=""
For i = 0 To (Len(MZYGCstr)-1)
If i<>(Len(MZYGCstr)-1) Then
tmp =tmp & InStr(cCode,Mid(MZYGCstr,i+1,1))-1 &"|"
Else
tmp =tmp & InStr(cCode,Mid(MZYGCstr,i+1,1))-1
End If
Nex
Response.Write "text = text.replace(/<\/?\w+:[^>]*>/gi, '') ;" & vbCrlf
Response.Write "text = text.replace(/ /, ' ' );" & vbCrlf
Response.Write "var re = new RegExp('(<P)([^>]*>.*?)(<\/P>)','gi') ;" & vbCrlf
Response.Write "text = text.replace( re, '<div$2</div>' ) ;" & vbCrlf
Response.Write "return text;" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "function atotxt()" & vbCrlf
Response.Write "{if ( confirm('如果转为文本格式将丢失所有排版内容,请确认是否这样做?')){MZYEDITWINDOW.focus();" & vbCrlf
Response.Write "MZYEDITWINDOW.document.body.innerHTML=HTMLEncode(MZYEDITWINDOW.document.body.innerText);}}" & vbCrlf
Response.Write "function wtohtm()" & vbCrlf
Response.Write "{if ( confirm('是否要将WORD格式去除?')){MZYEDITWINDOW.focus();" & vbCrlf
Response.Write "MZYEDITWINDOW.document.body.innerHTML=cleanword(MZYEDITWINDOW.document.body.innerHTML);}}" & vbCrlf
Response.Write "function CKjtb() {" & vbCrlf
Response.Write "var oDiv = document.getElementById('Temp_HTML');" & vbCrlf
Response.Write "oDiv.innerHTML = '' ;" & vbCrlf
Response.Write "var oTextRange = document.body.createTextRange() ;" & vbCrlf
Response.Write "oTextRange.moveToElementText(oDiv) ;" & vbCrlf
Response.Write "oTextRange.execCommand('Paste') ;" & vbCrlf
Response.Write "var sData = oDiv.innerHTML ;" & vbCrlf
Response.Write "oDiv.innerHTML = '' ;" & vbCrlf
Response.Write "var re = /<\w[^>]* class=""?MsoNormal""?/gi ; var nsData=sData;" & vbCrlf
Response.Write "if ( re.test(sData)){" & vbCrlf
Response.Write "if (confirm( '你要粘贴的内容好象是从Word中拷出来的,是否要先清除Word格式再粘贴?' )){" & vbCrlf
Response.Write "nsData=cleanword(sData) ;" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "MZYEDITWINDOW.document.selection.createRange().pasteHTML(nsData);" & vbCrlf
Response.Write "return false ;" & vbCrlf
Response.Write "}" & vbCrlf
Response.Write "setTimeout(""MZYEDITWINDOW.document.body.onpaste =CKjtb;"",1000);" & vbCrlf
Response.Write "</SCRIPT>" & vbCrlf
Response.Write "<!--END 史上最小的在线HTML编辑器,开发者:马政永,版本1.0 网站:http://www.lovemycn.com,本软件为授权使用,如没有马政永授权,任何人或单位不得使用,否则将已侵犯知识产权罪论处!-->" & vbCrlf
End Function
'**************************************************
'函数ID:0039[判断是否奇数]
'函数名:Is_JS
'作 用:判断是否奇数
'参 数:num ---- 要判断的数
'返回值:返回True,否则False
'**************************************************
Public Function Is_JS(ByVal num)
n=num mod 2
if n=1 then
Is_JS=true
else
Is_JS=false
end if
end function
'**************************************************
'函数ID:0040[生成验证码图像BMP]
'函数名:GrapCode
'作 用:生成验证码图像
'参 数:MZYGCstr ---- 要生成的图像的字符
'参 数:Noisy ---- 噪点率(大于0的整数)
'参 数:BkColor ---- 图案背景色(格式:R|G|B)
'参 数:FnColor ---- 字符颜色(格式:R|G|B)
'参 数:NoColor ---- 噪点颜色(格式:R|G|B)
'返回值:验证码图像
'示 例:Response.Write "<img src='" &GrapCode(Request("n"),6,"10|40|100","255|255|255","100|100|100")&"'>"
'**************************************************
Public Function GrapCode(ByVal MZYGCstr,ByVal Noisy,ByVal BkColor,ByVal FnColor,ByVal NoColor)
If Len(Trim(MZYGCstr))>1 Then
Dim imgsize,pimgsize
Const cAmount = 36
Const cCode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim ColorV(2)
tmp=""
tmp=Split(BkColor,"|")
ColorV(0) =""
For i = LBound(tmp) To UBound(tmp)
ColorV(0) = ColorV(0) & ChrB(CInt(tmp(i)))
Next
tmp=""
tmp=Split(FnColor,"|")
ColorV(1) =""
For i = LBound(tmp) To UBound(tmp)
ColorV(1) = ColorV(1) & ChrB(CInt(tmp(i)))
Next
tmp=""
tmp=Split(NoColor,"|")
ColorV(2) =""
For i = LBound(tmp) To UBound(tmp)
ColorV(2) = ColorV(2) & ChrB(CInt(tmp(i)))
Next
imgsize=10*Len(MZYGCstr)*10*24/8
pimgsize=10*Len(MZYGCstr)*10*24/8
If Is_JS(Len(MZYGCstr)) Then
imgsize=imgsize+74
pimgsize=pimgsize+20
Else
imgsize=imgsize+54
End If
imgsize =Hex(imgsize)
pimgsize=Hex(pimgsize)
imgsize =Cstr(imgsize)
pimgsize=Cstr(pimgsize)
'dword对齐处理
Dim length, byteCount,BytePatch
length = Len(MZYGCstr)
byteCount=((length*10*3) mod 4)
If byteCount>0 Then
byteCount= 4 - ((length*10*3) Mod 4)
For i=1 To byteCount : BytePatch = BytePatch & chrB(00) : Next
End If
tmp=""
For i=1 to len(imgsize) step 2
If (i < len(imgsize)) Then
tmp=tmp & Mid(imgsize,i,2) & "|"
Else
tmp=tmp & Mid(imgsize,i,2)
End If
Next
imgsize=StrReverse(tmp)
tmp=""
tmp=Split(imgsize,"|")
imgsize=""
For i = 0 To 3
If (i <= UBound(tmp)) Then
imgsize=imgsize & ChrB("&H"&tmp(i))
Else
imgsize=imgsize & ChrB(0)
End If
Next
ptmp=""
For i=1 to len(pimgsize) step 2
If (i < len(pimgsize)) Then
ptmp=ptmp & Mid(pimgsize,i,2) & "|"
Else
ptmp=ptmp & Mid(pimgsize,i,2)
End If
Next
pimgsize=StrReverse(ptmp)
ptmp=""
ptmp=Split(pimgsize,"|")
pimgsize=""
For i = 0 To 3
If (i <= UBound(ptmp)) Then
pimgsize=pimgsize & ChrB("&H"&ptmp(i))
Else
pimgsize=pimgsize & ChrB(0)
End If
Next
MZYGCstr=UCase(MZYGCstr)
tmp=""
For i = 0 To (Len(MZYGCstr)-1)
If i<>(Len(MZYGCstr)-1) Then
tmp =tmp & InStr(cCode,Mid(MZYGCstr,i+1,1))-1 &"|"
Else
tmp =tmp & InStr(cCode,Mid(MZYGCstr,i+1,1))-1
End If
Nex
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] 下一页

