ASP函数库7


'**************************************************
  '函数ID:0037[测试数据库中的表是否存在]
  '函数名:TestTbOK
  '作 用:测试数据库中的表是否存在
  '参 数:ObjConnName ---- 数据库链接定义
  '参 数:TestDbname ---- 被测试表的名称
  '返回值:测试成功返回 True 否则 False
  '示 例:TestTbOK(TestConn,"tbname")
  '**************************************************
  Public Function TestTbOK(ByVal ObjConnName,ByVal TestDbname)
   TestTbOK=False
   DIM fu_Rs
   Set fu_Rs=server.createobject("ADODB.Recordset")
   On Error GoTo 0
   On Error Resume Next
   fu_Rs.open "SELECT * FROM "&TestDbname,ObjConnName,1,1
   fu_Rs.Close
   If Err.Number = 0 Then
   TestTbOK=True
   End If
   On Error GoTo 0
   Set fu_Rs = Nothing
  End Function
  '**************************************************
  '函数ID:0038[在线HTML编辑器]
  '函数名:HTML_MZYEDIT
  '作 用:测试数据库中的表是否存在
  '参 数:MEIPath ---- 各图标图像所在的路径
  '参 数:GtimgPath ---- 图片上传程序的URL
  '参 数:GtswfPath ---- Flash动画上传程序的URL
  '参 数:GtwavPath ---- 音乐文件上传程序的URL
  '参 数:GtotherPath ---- 其他文件上传程序的URL
  '返回值:HTML编辑器
  '示 例:
  '**************************************************
  Public Function HTML_MZYEDIT(ByVal MEIPath,ByVal GtimgPath,ByVal GtswfPath,ByVal GtwavPath,ByVal GtotherPath)
   Response.Write "<!--BEGIN 史上最小的在线HTML编辑器,开发者:马政永,版本1.0 网站:http://www.lovemycn.com,本软件为授权使用,如没有马政永授权,任何人或单位不得使用,否则将已侵犯知识产权罪论处!-->" & vbCrlf
   Response.Write "<style>img{border: 1 solid #DFDED2;}</style>" & vbCrlf
   Response.Write "<table onConTextMenu ='event.returnValue=false;' style='"">宋体; font-size: 9pt;cursor:default;width:100%;height:100%;' bgcolor='#DFDED2'><tr><td style='width:100%;height:0%;'>" & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='撤消' SRC='"&MEIPath&"undo.gif' NAME='Undo' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='恢复' SRC='"&MEIPath&"redo.gif' NAME='Redo' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='剪切' SRC='"&MEIPath&"cut.gif' NAME='Cut' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='拷贝' SRC='"&MEIPath&"copy.gif' NAME='Copy' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='粘贴' SRC='"&MEIPath&"paste.gif' NAME='Paste' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='删除' SRC='"&MEIPath&"delete.gif' NAME='Delete' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='距左' SRC='"&MEIPath&"aleft.gif' NAME='JustifyLeft' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='距中' SRC='"&MEIPath&"center.gif' NAME='JustifyCenter' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='距右' SRC='"&MEIPath&"aright.gif' NAME='JustifyRight' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' SRC='"&MEIPath&"fgs.gif'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='加粗' SRC='"&MEIPath&"bold.gif' NAME='Bold' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='斜体' SRC='"&MEIPath&"italic.gif' NAME='Italic' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='下划线' SRC='"&MEIPath&"underline.gif' NAME='Underline' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='超链' SRC='"&MEIPath&"wlink.gif' NAME='CreateLink' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='取消超链' SRC='"&MEIPath&"uwlink.gif' NAME='Unlink' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='取消格式' SRC='"&MEIPath&"untype.gif' NAME='RemoveFormat' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='水平线' SRC='"&MEIPath&"hr.gif' NAME='InsertHorizontalRule' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='缩进' SRC='"&MEIPath&"indent.gif' NAME='Indent' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='取消缩进' SRC='"&MEIPath&"outdent.gif' NAME='Outdent' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='数字标识' SRC='"&MEIPath&"numlist.gif' NAME='InsertOrderedList' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='点标识' SRC='"&MEIPath&"bullist.gif' NAME='InsertUnorderedList' ONCLICK='dojob(this.name);' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='加入图片' SRC='"&MEIPath&"img.gif' NAME='InsertImage' ONCLICK='inputimage();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='加入FLASH' SRC='"&MEIPath&"intole.gif' NAME='Inputother' ONCLICK='inputother();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='加入影音文件' SRC='"&MEIPath&"play.gif' NAME='Inputother' ONCLICK='inputotherpl();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='加入文件链接' SRC='"&MEIPath&"otlin.gif' NAME='Inputother' ONCLICK='inputotlink();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='插入Excel工作表' SRC='"&MEIPath&"excel.gif' NAME='excel' ONCLICK='inputexcel();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='去除Word格式' SRC='"&MEIPath&"wordtot.gif' NAME='wordtot' ONCLICK='wtohtm();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='转为TXT格式' SRC='"&MEIPath&"txt.gif' NAME='totxt' ONCLICK='atotxt();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='查看源码' SRC='"&MEIPath&"html.gif' NAME='edbh' ID='edbh' ONCLICK='htbhtxt();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();'> " & vbCrlf
   Response.Write "<IMG BORDER='0' ALT='在IE里预览' SRC='"&MEIPath&"view.gif' NAME='bh' ONCLICK='view();' onmouseout='mmoo();' onmouseover='mmoo();' onmousedown='mmoo();' onmouseup='mmoo();' >" & vbCrlf
   Response.Write "<IMG BORDER='0' SRC='"&MEIPath&"fgs.gif'> " & vbCrlf
   Response.Write "<SELECT NAME='FontName' STYLE='width:94;font-size: 9pt;cursor:default;' ONCHANGE='doadv(this.name,this[this.selectedIndex].value);this.selectedIndex=0;'>" & vbCrlf
   Response.Write "<OPTION SELECTED>字体</OPTION><OPTION VALUE='宋体'>宋体</OPTION><OPTION VALUE='黑体'>黑体</OPTION><OPTION VALUE='楷体_GB2312'>楷体</OPTION><OPTION VALUE='Arial'>Arial</OPTION><OPTION VALUE='Arial Black'>Arial Black</OPTION><OPTION VALUE='Wingdings'>Wingdings</OPTION>" & vbCrlf
   Response.Write "</SELECT><SELECT NAME='FontSize' STYLE='width:50;font-size: 9pt;cursor:default;' ONCHANGE='doadv(this.name,this[this.selectedIndex].value);this.selectedIndex=0;'>" & vbCrlf
   Response.Write "<OPTION SELECTED>字号</OPTION><OPTION VALUE='7'>一号</OPTION><OPTION VALUE='6'>二号</OPTION><OPTION VALUE='5'>三号</OPTION><OPTION VALUE='4'>四号</OPTION><OPTION VALUE='3'>五号</OPTION><OPTION VALUE='2'>六号</OPTION><OPTION VALUE='1'>七号</OPTION>" & vbCrlf
   Response.Write "</SELECT><SELECT NAME='ForeColor' STYLE='width:50;font-size: 9pt;cursor:default;' ONCHANGE='doadv(this.name,this[this.selectedIndex].value);this.selectedIndex=0;'>" & vbCrlf
   Response.Write "<OPTION SELECTED VALUE='#000000'>字色</OPTION><OPTION VALUE='#FFFFFF' STYLE='color:#FFFFFF'>●</OPTION><OPTION VALUE='#000000' STYLE='color:#000000'>●</OPTION><OPTION VALUE='#800000' STYLE='color:#800000'>●</OPTION><OPTION VALUE='#FF0000' STYLE='color:#FF0000'>●</OPTION><OPTION VALUE='#000080' STYLE='color:#000080'>●</OPTION>" & vbCrlf
   Response.Write "</SELECT><font color='#3D3D3D'> 表格[<INPUT TYPE='text' NAME='T_H' SIZE='3' VALUE='2' style='"">宋体; font-size: 9pt'>行<INPUT TYPE='text' NAME='T_L' SIZE='3' VALUE='2' style='"">宋体; font-size: 9pt'>列<INPUT TYPE='button' VALUE='插入' NAME='B1' ONCLICK='InsertOle(inputtable(T_H.value,T_L.value));' style='"">宋体; font-size: 9pt'>]</font> <IMG BORDER='0' SRC='"&MEIPath&"fgs.gif'>" & vbCrlf
   Response.Write "</td></tr><tr><td style='width:100%;height:100%;'>"
   Response.Write "<IFRAME SRC='about:blank' ID='MZYEDITWINDOW' style='width:100%;height:100%;'></IFRAME><div id='Temp_HTML' style='VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px'></div>" & vbCrlf
   Response.Write "</td></tr></table>" & vbCrlf
   Response.Write "<SCRIPT language='javascript'>" & vbCrlf
   Response.Write "var Htmlmode='Y';" & vbCrlf
   Response.Write "var Htmldata='';" & vbCrlf
   Response.Write "MZYEDITWINDOW.document.designMode='On';MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "var pjob;" & vbCrlf
   Response.Write "function mmoo()" & vbCrlf
   Response.Write "{pjob=(window.event.type).toUpperCase();" & vbCrlf
   Response.Write "if ((pjob=='MOUSEOVER') || (pjob=='MOUSEUP')){event.srcElement.style.borderLeft='1 solid #808080';" & vbCrlf
   Response.Write "event.srcElement.style.borderRight='1 solid #FFFFFF';" & vbCrlf
   Response.Write "event.srcElement.style.borderTop='1 solid #FFFFFF';" & vbCrlf
   Response.Write "event.srcElement.style.borderBottom='1 solid #808080';}" & vbCrlf
   Response.Write "if ((pjob=='MOUSEOUT') || (pjob=='MOUSEDOWN')){event.srcElement.style.border='1 solid #DFDED2';}" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function dojob(doname)" & vbCrlf
   Response.Write "{MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "ckmode();MZYEDITWINDOW.document.execCommand(doname);}" & vbCrlf
   Response.Write "function doadv(doname,jobtxt)" & vbCrlf
   Response.Write "{MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "ckmode();MZYEDITWINDOW.document.execCommand(doname,false,jobtxt);}" & vbCrlf
   Response.Write "function InsertOle(date)" & vbCrlf
   Response.Write "{ckmode();MZYEDITWINDOW.focus();MZYEDITWINDOW.document.selection.createRange().pasteHTML(date);}" & vbCrlf
   Response.Write "function htbhtxt()" & vbCrlf
   Response.Write "{MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "if (Htmlmode=='Y'){MZYEDITWINDOW.document.body.innerText=MZYEDITWINDOW.document.body.innerHTML;Htmlmode='N';edbh.alt='恢复HTML编辑状态';" & vbCrlf
   Response.Write "}else{MZYEDITWINDOW.document.body.innerHTML=MZYEDITWINDOW.document.body.innerText;Htmlmode='Y';edbh.alt='查看源码';}}" & vbCrlf
   Response.Write "function ckmode()" & vbCrlf
   Response.Write "{if (Htmlmode=='N'){MZYEDITWINDOW.document.body.innerHTML=MZYEDITWINDOW.document.body.innerText;Htmlmode='Y';}" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function view(){testwin=open('', 'testwin','status=no,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');testwin.document.open();testwin.document.write(MZYEDITWINDOW.document.body.innerHTML);}" & vbCrlf
   Response.Write "function inputexcel(){s='<OBJECT id=Spreadsheet1 codeBase=file:\Bobsoftwareoffice2000msowc.cab height=250 width=100% classid=clsid:0002E510-0000-0000-C000-000000000046></OBJECT>';InsertOle(s);}" & vbCrlf
   Response.Write "function inputtable(h,l)" & vbCrlf
   Response.Write "{" & vbCrlf
   Response.Write "s='<table border=1 width=100% cellspacing=0 cellpadding=0>';" & vbCrlf
   Response.Write "for(i=1 ;i<=l;i++){s=s+'<tr>';for(j=1;j<=h;j++)s=s+'<td> </td>';s=s+'</tr>';}" & vbCrlf
   Response.Write "s=s+'</table>';" & vbCrlf
   Response.Write "return s;" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function inputimage()" & vbCrlf
   Response.Write "{" & vbCrlf
   Response.Write "var temp=showModalDialog('"&GtimgPath&"','', 'dialogWidth:30em; dialogHeight:26em; status:0');" & vbCrlf
   Response.Write "MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "if ((temp!==null) && (temp!==''))" & vbCrlf
   Response.Write "doadv('InsertImage',temp);" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function inputother()" & vbCrlf
   Response.Write "{" & vbCrlf
   Response.Write "var temp=showModalDialog('"&GtswfPath&"','', 'dialogWidth:30em; dialogHeight:26em;status:0');" & vbCrlf
   Response.Write "var tempa="&chr(34)&"<p align='center'><a onclick='MZYmovie.Play();' STYLE='cursor:hand;'>播放</a> <a onclick='MZYmovie.StopPlay();' STYLE='cursor:hand;'>暂停</a> <a onclick=\"&chr(34)&"MZYmovie.width='600';MZYmovie.height='600';\"&chr(34)&" STYLE='cursor:hand;'>最大化</a> <a onclick=\"&chr(34)&"MZYmovie.width='500';MZYmovie.height='400';\"&chr(34)&" STYLE='cursor:hand;'>恢复</a><br><table NAME='FFWH' ID='FFWH' border='0' width='100%' height='100%' cellspacing='0' cellpadding='0'><tr><td width='100%' height='90%' valign='middle' align='center'>"&chr(34)&";" & vbCrlf
   Response.Write "var tempb="&chr(34)&"<EMBED SRC='"&chr(34)&";" & vbCrlf
   Response.Write "var tempc="&chr(34)&"' WIDTH='500' HEIGHT='400' QUALITY='high' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' TYPE='application/x-shockwave-flash' ID='MZYmovie' NAME='MZYmovie' MENU='false'>"&chr(34)&";" & vbCrlf
   Response.Write "var tempd="&chr(34)&"</td></tr></table></p>"&chr(34)&";" & vbCrlf
   Response.Write "MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "if ((temp!==null) && (temp!==''))" & vbCrlf
   Response.Write "temp=tempa+tempb+temp+tempc+tempd;" & vbCrlf
   Response.Write "InsertOle(temp);" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function inputotherpl()" & vbCrlf
   Response.Write "{" & vbCrlf
   Response.Write "var pl_w = prompt('录入影片的宽度', '100');" & vbCrlf
   Response.Write "var pl_h = prompt('录入影片的高度', '100');" & vbCrlf
   Response.Write "var tempwh="&chr(34)&"WIDTH="&chr(34)&"+pl_w+"&chr(34)&" HEIGHT="&chr(34)&"+pl_h;"
   Response.Write "var temp=showModalDialog('"&GtwavPath&"','', 'dialogWidth:30em; dialogHeight:26em; status:0');" & vbCrlf
   Response.Write "var temprma="&chr(34)&"<OBJECT CLASSID='clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' ID='MZYMPL' "&chr(34)&";"
   Response.Write "var temprmb="&chr(34)&"><PARAM NAME='SRC' VALUE='"&chr(34)&";"
   Response.Write "var temprmc="&chr(34)&"'></OBJECT>"&chr(34)&";"
   Response.Write "var tempmpa="&chr(34)&"<OBJECT CLASSID='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6' ID='MZYMPL'"&chr(34)&";"
   Response.Write "var tempmpb="&chr(34)&"><PARAM NAME='URL' VALUE='"&chr(34)&";"
   Response.Write "var tempmpc="&chr(34)&"'></OBJECT>"&chr(34)&";"
   Response.Write "MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "if ((temp!==null) && (temp!==''))" & vbCrlf
   Response.write "var pllx = confirm('是否使用Windows media player?')"&vbCrlf
   Response.write "if (pllx != '0'){"&vbCrlf
   Response.Write "temp=tempmpa+' '+tempwh+' '+tempmpb+temp+tempmpc;"&vbCrlf
   Response.Write "}else{"&vbCrlf
   Response.Write "temp=temprma+' '+tempwh+' '+temprmb+temp+temprmc;"&vbCrlf
   Response.Write "}"&vbCrlf
   Response.Write "InsertOle(temp);" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function inputotlink()" & vbCrlf
   Response.Write "{" & vbCrlf
   Response.Write "var linkname = prompt('录入链接文字说明', '点这下载');" & vbCrlf
   Response.Write "var temp=showModalDialog('"&GtotherPath&"','', 'dialogWidth:30em; dialogHeight:26em; status:0');" & vbCrlf
   Response.Write "MZYEDITWINDOW.focus();" & vbCrlf
   Response.Write "if ((temp!==null) && (temp!=='')){" & vbCrlf
   Response.Write "temp="&chr(34)&"<a href="&chr(34)&"+temp+"&chr(34)&" _fcksavedurl=""&chr(34)&"+temp+"&chr(34)&"" _fcksavedurl=""&chr(34)&"+temp+"&chr(34)&"" _fcksavedurl=""&chr(34)&"+temp+"&chr(34)&"" target='_blank'>"&chr(34)&"+linkname+"&chr(34)&"</a>"&chr(34)&";" & vbCrlf
   Response.Write "InsertOle(temp);}" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function HTMLEncode(text){" & vbCrlf
   Response.Write "text = text.replace(/&/g, '&') ;" & vbCrlf
   Response.Write "text = text.replace(/""/g, '"') ;" & vbCrlf
   Response.Write "text = text.replace(/</g, '<') ;" & vbCrlf
   Response.Write "text = text.replace(/>/g, '>') ;" & vbCrlf
   Response.Write "text = text.replace(/'/g, '’') ;" & vbCrlf
   Response.Write "text = text.replace(/\ /g,' ');" & vbCrlf
   Response.Write "text = text.replace(/\n/g,'<br>');" & vbCrlf
   Response.Write "text = text.replace(/\t/g,'    ');" & vbCrlf
   Response.Write "return text;" & vbCrlf
   Response.Write "}" & vbCrlf
   Response.Write "function cleanword(text) {" & vbCrlf
   Response.Write "text = text.replace(/<\/?SPAN[^>]*>/gi, '' );" & vbCrlf
   Response.Write "text = text.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, '<{GetProperty(Content)}$3') ;" & vbCrlf
   Response.Write "text = text.replace(/<(\w[^>]*)([^""]*)""([^>]*)/gi, '<{GetProperty(Content)}$3') ;" & vbCrlf
   Response.Write "text = text.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, '<{GetProperty(Content)}$3') ;" & vbCrlf
   Response.Write "text = text.replace(/<\\?\?xml[^>]*>/gi, '') ;" & 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

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3