⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmledit.asp

📁 html编辑器
💻 ASP
📖 第 1 页 / 共 4 页
字号:
  Response.Write "    var crrantxtobj;" & vbCrlf
  Response.Write "    if (wtxt!=''){" & vbCrlf
  Response.Write "     if (window.navigator.userAgent.indexOf('MSIE')>=1){" & vbCrlf
  Response.Write "        crrantxtobj=editor.document.selection.createRange();crrantxtobj.pasteHTML(wtxt);" & vbCrlf
  Response.Write "     }else{" & vbCrlf
  Response.Write "        crrantxtobj= editor.document.getSelection();" & vbCrlf
  Response.Write "        insert_html(wtxt);" & vbCrlf
  Response.Write "     }" & vbCrlf
  Response.Write "    }" & vbCrlf
  Response.Write " }" & vbCrlf
  Response.Write " function insert_html(html){" & vbCrlf
  Response.Write " var random_string = 'insert_html_' + Math.round(Math.random()*100000000);" & vbCrlf
  Response.Write " editor.document.execCommand('insertimage',false, random_string);" & vbCrlf
  Response.Write " var pat = new RegExp('<[^<]*' + random_string + '[^>]*>');" & vbCrlf
  Response.Write " editor.document.body.innerHTML = editor.document.body.innerHTML.replace(pat, html);" & vbCrlf
  Response.Write " }" & vbCrlf
  Response.Write "function gtselectnrxx(){" & vbCrlf
  Response.Write "        var rng=null,html='';" & vbCrlf
  Response.Write "        if (editor.document.selection && editor.document.selection.createRange){" & vbCrlf
  Response.Write "                rng=editor.document.selection.createRange();" & vbCrlf
  Response.Write "                html=rng.htmlText||'';" & vbCrlf
  Response.Write "        }else if (editor.getSelection){" & vbCrlf
  Response.Write "                rng=editor.getSelection();" & vbCrlf
  Response.Write "                if (rng.rangeCount > 0 && editor.XMLSerializer){" & vbCrlf
  Response.Write "                        rng=rng.getRangeAt(0);" & vbCrlf
  Response.Write "                        html=new XMLSerializer().serializeToString(rng.cloneContents());" & vbCrlf
  Response.Write "                }" & vbCrlf
  Response.Write "        }" & vbCrlf
  Response.Write "       return html;" & vbCrlf
  Response.Write "}" & vbCrlf
  Response.Write "</SCRIPT>" & vbCrlf
  Response.Write "</html>" & vbCrlf
  Response.end()
End function

''===============================================================================''
''=  模块ID:002[上传文件模块]           MZYHTMLEDIT_upload()                   =''
''===============================================================================''
Function MZYHTMLEDIT_upload()
  DIM MyArray,TemArray,wjmc,wjlx,wjnr,wjdm,wjlb,uscd,showlx
  showlx   = Trim(Request("lx"))
  MyArray  = MUPFilesGetv()
  wjmc     = MyArray(MUPGtArrayone(MyArray,0,"F_Data"),2)
  TemArray = Split(wjmc, ".")
  wjmc     = TemArray(0)
  wjlx     = UCase(TemArray(1))
  wjnr     = MyArray(MUPGtArrayone(MyArray,0,"F_Data"),1)
  wjlb     = MyArray(MUPGtArrayone(MyArray,0,"F_Data"),3)
  wjdm     = GetMyTimeNumber(0)
  uscd     = DecodeCookie(Request.Cookies("MZYHTMLEDIT")("USERCODE"))
  ''''  数据操作  ''''
  DIM temp_Conn,temp_Rs,temp_Sqltxt,vvnr
  Set temp_Conn=server.createobject("ADODB.Connection")
  Set temp_Rs  =server.createobject("ADODB.Recordset")
  temp_Conn.open SYSDB_connstr
  temp_Sqltxt="SELECT * FROM IMAGES WHERE (1<>1)"
  temp_Rs.open temp_Sqltxt,temp_Conn,3,3
  temp_Rs.addnew
  temp_Rs("IMAGES_ID")  =wjdm
  temp_Rs("IMAGES_MC")  =wjmc
  temp_Rs("IMAGES_LX")  =wjlx
  temp_Rs("IMAGES_LB")  =wjlb
  temp_Rs("USERCODE")   =uscd
  temp_Rs("IMGS").AppendChunk wjnr
  temp_Rs.update
  temp_Rs.Close
  temp_Conn.Close
  Set temp_Rs = Nothing
  Set temp_Conn = Nothing
  vvnr=SHOWMTPATH & wjdm
  Response.Write "<script language='javascript'>function GId(id){return parent.document.getElementById(id);}GId('TURL').value='" & vvnr & "';"
  if (showlx="pic") Then
     Response.Write "document.location.href='htmledit.asp?job=list&lx=pic';</script>"
  End If
  if (showlx="other") Then
     Response.Write "document.location.href='htmledit.asp?job=list&lx=other';</script>"
  End If
  if (showlx="") Then
     Response.Write "document.location.href='htmledit.asp?job=list';</script>"
  End If
  Response.end()
End function

''===============================================================================''
''=  模块ID:003[下载文件模块]           MZYHTMLEDIT_download()                 =''
''===============================================================================''
Function MZYHTMLEDIT_download()
  DIM showid,tpmc,tphz,tplx,bytewj
  showid=Request("dm")
  DIM temp_Conn,temp_Rs,temp_Sqltxt
  Set temp_Conn=server.createobject("ADODB.Connection")
  Set temp_Rs  =server.createobject("ADODB.Recordset")
  temp_Conn.open SYSDB_connstr
  temp_Sqltxt="SELECT IMAGES_MC,IMAGES_LX,IMAGES_LB,IMGS FROM IMAGES WHERE (IMAGES_ID='" & showid & "')"
  temp_Rs.open temp_Sqltxt,temp_Conn,1,1
  If temp_Rs.RecordCount >0 Then
        tpmc   = Trim(temp_Rs("IMAGES_MC"))
        tphz   = Trim(temp_Rs("IMAGES_LX"))
        tplx   = Trim(temp_Rs("IMAGES_LB"))
        bytewj = temp_Rs("IMGS")
  End If
  temp_Rs.Close
  temp_Conn.Close
  Set temp_Rs = Nothing
  Set temp_Conn = Nothing
  Response.Clear
  Response.Expires = -9999
  Response.AddHeader "pragma", "no-cache"
  Response.AddHeader "cache-ctrol", "no-cache"
  Response.Buffer = TRUE
  Response.AddHeader "Content-Disposition:","attachment;filename="""& tpmc &"." & tphz & """"
  Response.ContentType=tplx
  Response.Flush
  Response.BinaryWrite bytewj
  Response.end()
End function

''===============================================================================''
''=  模块ID:004[上传文件列表选择]           MZYHTMLEDIT_upList()               =''
''===============================================================================''
Function MZYHTMLEDIT_upList()
  DIM tpmc,tphz,tpdm,bytewj,uscd,i,showlx
  showlx   = Trim(Request("lx"))
  uscd=DecodeCookie(Request.Cookies("MZYHTMLEDIT")("USERCODE"))
  DIM temp_Conn,temp_Rs,temp_Sqltxt
  Response.Write "<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>LIST</title></head><body scrolling='auto' topmargin='0' leftmargin='0' rightmargin='0' bottommargin='0' marginwidth='0' marginheight='0' style='background-color:#F7F7EA;overflow-x:no;overflow-y:auto;'>" & vbCrlf
  Set temp_Conn=server.createobject("ADODB.Connection")
  Set temp_Rs  =server.createobject("ADODB.Recordset")
  temp_Conn.open SYSDB_connstr
  if (showlx="pic") then
     temp_Sqltxt="SELECT IMAGES_ID,IMAGES_MC,IMAGES_LX FROM IMAGES WHERE (USERCODE='" & uscd & "') AND ((IMAGES_LX='GIF') OR (IMAGES_LX='JPG') OR (IMAGES_LX='PNG') OR (IMAGES_LX='BMP')) ORDER BY ID DESC"
  End If
  if (showlx<>"pic") then
     temp_Sqltxt="SELECT IMAGES_ID,IMAGES_MC,IMAGES_LX FROM IMAGES WHERE (USERCODE='" & uscd & "') ORDER BY ID DESC"
  End If
  temp_Rs.open temp_Sqltxt,temp_Conn,1,1
  i=temp_Rs.RecordCount
  If temp_Rs.RecordCount >0 Then
     Do While Not temp_Rs.Eof
        tpmc   = Trim(temp_Rs("IMAGES_MC"))
        tphz   = Trim(temp_Rs("IMAGES_LX"))
        tpdm   = Trim(temp_Rs("IMAGES_ID"))
        if (showlx="pic") then
           Response.Write "<span id='"& i &"' OnClick=""clickspan(this.id);parent.document.getElementById('BDIMAGESPATH').src='" & SHOWMTPATH & tpdm & "';parent.document.getElementById('TURL').value='" & SHOWMTPATH & tpdm & "';"" style=""overflow: hidden; white-space: nowrap; text-overflow: ellipsis;line-height:18px;font-family: 宋体; font-size: 12px; color: #364544;background-color:expression((this.id%2==0)?'#FFFEE6':'#FFFDD7');cursor: hand;width:98%;"""
        Else
           Response.Write "<span id='"& i &"' OnClick=""clickspan(this.id);parent.document.getElementById('TURL').value='" & SHOWMTPATH & tpdm & "';"" style=""overflow: hidden; white-space: nowrap; text-overflow: ellipsis;line-height:18px;font-family: 宋体; font-size: 12px; color: #364544;background-color:expression((this.id%2==0)?'#FFFEE6':'#FFFDD7');cursor: hand;width:98%;"""
        End If
        Response.Write " title='单击选择 [" & i & "]" & tpmc & "." & tphz & "'>"
        Response.Write "[" & i & "]" & tpmc & "." & tphz
        Response.Write "</span><br>" & vbCrlf
        i=i-1
        temp_Rs.MoveNext
     Loop
  End If
  temp_Rs.Close
  temp_Conn.Close
  Set temp_Rs = Nothing
  Set temp_Conn = Nothing
  Response.Write "<script language=javascript>" & vbCrlf
  Response.Write "var selectspan='';" & vbCrlf
  Response.Write "function GetId(id){return document.getElementById(id);}" & vbCrlf
  Response.Write "function clickspan(id){GetId(id).style.border='2px dotted #FF0000';" & vbCrlf
  Response.Write "if (selectspan!=''){GetId(selectspan).style.border='';}" & vbCrlf
  Response.Write "selectspan=id;}" & vbCrlf
  Response.Write "</script>" & vbCrlf
  Response.Write "</body></html>"
  Response.end()
End function

Function Readsyspath(ByVal lx)
  Dim templj,aryTemp,newpath,i
  templj=""
  newpath=""
  If lx=0 Then
     templj  = "http://"&Request("SERVER_NAME")&Request("PATH_INFO")
     aryTemp = Split(templj,"/") 
  End If
  If lx=1 Then
     templj  = Request("PATH_TRANSLATED")
     aryTemp = Split(templj,"\") 
  End If
  If lx=2 Then
     templj  = Request("PATH_INFO")
     aryTemp = Split(templj,"/") 
  End If
  For i = LBound(aryTemp) To UBound(aryTemp)-1
      If ((lx=0) OR (lx=2)) Then
         newpath=newpath&aryTemp(i)&"/"
      Else
         newpath=newpath&aryTemp(i)&"\"
      End If
  Next
  Readsyspath=newpath
End Function

Public Function GetMyTimeNumber(ByVal lx)
  randomize
  If lx=0 Then GetMyTimeNumber=Year(Date)*12*30*24*60*60*100+Month(Date)*30*24*60*60*100+Day(Date)*24*60*60*100+Hour(Time)*60*60*100+Minute(Time)*60*100+Second(Time)*100+Int(100 * Rnd)
  If lx=1 Then GetMyTimeNumber=Year(Date)*12*30*24*60*60+Month(Date)*30*24*60*60+Day(Date)*24*60*60+Hour(Time)*60*60+Minute(Time)*60+Second(Time)
  If lx=2 Then GetMyTimeNumber=Year(Date)*12*30*24*60+Month(Date)*30*24*60+Day(Date)*24*60+Hour(Time)*60+Minute(Time)
  If lx=3 Then GetMyTimeNumber=Year(Date)*12*30*24+Month(Date)*30*24+Day(Date)*24+Hour(Time)
  If lx=4 Then GetMyTimeNumber=Year(Date)*12*30+Month(Date)*30+Day(Date)
  If lx=5 Then GetMyTimeNumber=Year(Date)*12+Month(Date)
End Function

Public Function CodeCookie(ByVal str)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -