作家
登录

写了几个类,希望对大家有用。

作者: 来源:www.28hudong.com 2013-03-30 03:54:24 阅读 我要评论

1.日历 #oContainer { width: 193px; padding: 3px; background-color: menu; border-left: buttonhighlight 1px solid; border-top: buttonhighlight 1px solid; border-right: buttonshadow 1px solid; border-bottom: buttonshadow 2px solid; } .DateTable { font: 10pt; word-break: break-all; } .WeekTd, .BlankTd { font: 10pt; border: 1px solid menu; } .Today { font: 10pt; color: red; cursor: hand; position: relative; left: 1px; top: 1px; border-left: 1px solid dimgray; border-top: 1px solid dimgray; border-right: 1px solid white; border-bottom: 1px solid white; } .MonthTd { font: 10pt; font-family: webdings; cursor: hand; border: 1px solid menu; zmm: expression(onmouseenter = function() { style.color = 'red'; }, onmouseout = function() { style.color = ''; }); } .SelectTd { border: 1px solid menu; } .over { position: relative; cursor: hand; border-right: 1px solid buttonshadow; border-bottom: 1px solid buttonshadow; border-left: 1px solid buttonhighlight; border-top: 1px solid buttonhighlight; } .out { border-left: 1px solid buttonface; border-top: 1px solid buttonface; border-right: 1px solid buttonface; border-bottom: 1px solid buttonface; } .down { position: relative; left: 1px; top: 1px; border-left: 1px solid dimgray; border-top: 1px solid dimgray; border-right: 1px solid white; border-bottom: 1px solid white; } [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]2.简单的下拉菜单 #oData { display: none; } #oPanel { width: 120px; font-size: 12px; border: 1px solid menu; padding: 2px; position: absolute; display: none; } span { font-size: 12px; cursor: hand; } 命令一 命令二 命令三 命令四 命令五 命令六 命令七 命令八 菜单一 菜单二 菜单三 菜单四 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]3. QQ菜单效果 #oContainer { width: 130px; height: 300px; border: 1px solid menu; } [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]4.对联效果 对联内容 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]5.图片轮换 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]6.listView类 #oContainer { width: 600px; height: 500px; border: 1px solid menu; margin: 0px; padding: 0px; overflow: hidden; } a { color: black; text-decoration: none; } a:hover { color: red; text-decoration: underline; } [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]7.表单多文件上传类 [ASP] 2 Then ReDim Preserve itemStart(itemCount) ReDim Preserve itemLength(itemCount) itemStart(itemCount) = iStart itemLength(itemCount) = iLength itemCount = itemCount + 1 End If Loop Call FillItemValue End Function Private Function FillItemValue Dim dataPart, bInfor Dim iStart : iStart = 1 Dim iCount : iCount = 0 Dim iCheck : iCheck = StrToByte("filename") For i = 0 To itemCount - 1 ReDim Preserve itemName(iCount) ReDim Preserve itemData(iCount) ReDim Preserve extenArr(iCount) ReDim Preserve dataStart(iCount) ReDim Preserve dataLength(iCount) dataPart = MidB(formData, itemStart(i), itemLength(i)) iStart = InStrB(1, dataPart, ChrB(34)) + 1 iLength = InStrB(iStart, dataPart, ChrB(34)) - iStart itemName(iCount) = FormItemName(MidB(dataPart, iStart, iLength)) iStart = InStrB(1, dataPart, bVBCrlf) + 4 iLength = LenB(dataPart) - iStart + 1 If InStrB(1, dataPart, iCheck) > 0 Then bInfor = MidB(dataPart, 1, iStart - 5) extenArr(iCount) = FileExtenName(bInfor) If Mid(folderPath, Len(folderPath) - 1) = "/" Then itemData(iCount) = folderPath & GetRndName(6) & extenArr(iCount) Else itemData(iCount) = folderPath & "/" & GetRndName(6) & extenArr(iCount) End If dataStart(iCount) = itemStart(i) + iStart - 2 dataLength(iCount) = iLength Else extenArr(iCount) = "" itemData(iCount) = ByteToStr(MidB(dataPart, iStart, iLength)) dataStart(iCount) = "" dataLength(iCount) = "" End If iCount = iCount + 1 Next Call SaveUpload End Function Private Function FormItemName(byVal bName) FormItemName = ByteToStr(bName) End Function Private Function FileExtenName(byVal bInfor) Dim pStart, pLength, pContent, regEx pStart = InStr(1, ByteToStr(bInfor), "filename=" & Chr(34)) + 10 pLength = InStr(pStart, ByteToStr(bInfor), Chr(34)) - pStart pContent = Mid(ByteToStr(bInfor), pStart, pLength) If pContent = "" Then FileExtenName = "" Else Set regEx = New RegExp regEx.Pattern = "^.*(.[^.]*)$" regEx.Global = False regEx.IgnoreCase = True FileExtenName = regEx.Replace(pContent, "$1") Set regEx = Nothing End If End Function Private Function GetRndName(byVal sLen) Dim regEx, sTemp, arrFields, n : n = 0 Set regEx = New RegExp regEx.Pattern = "[^d]*" regEx.Global = True regEx.IgnoreCase = True sTemp = regEx.Replace(Now, "") & "-" Set regEx = Nothing arrFields = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", _ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", _ "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", _ "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", _ "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", _ "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", _ "Y", "Z") Randomize Do While n "") And (dataLength(i) "") Then If dataLength(i) = 0 Then itemData(i) = "" Else filePath = Server.MapPath(itemData(i)) If CreateFolder("|", ParentFolder(filePath)) Then Set oStreamGet = Server.CreateObject("ADODB.Stream") oStreamGet.Type = 1 oStreamGet.Mode = 3 oStreamGet.Open oStreamGet.Write formData oStreamGet.Position = dataStart(i) Set oStreamPut = Server.CreateObject("ADODB.Stream") oStreamPut.Type = 1 oStreamPut.Mode = 3 oStreamPut.Open oStreamPut.Write oStreamGet.Read(dataLength(i)) oStreamPut.SaveToFile(filePath) oStreamGet.Close Set oStreamGet = Nothing oStreamPut.Close Set oStreamPut = Nothing End If End If End If Next Finished = True Call ItemToColl Else Finished = False End If End Function Private Function CheckFile Dim oBoolean : oBoolean = True If cFields = "" Then oBoolean = oBoolean And True Else For i = 0 To itemCount - 1 If extenArr(i) "" Then If InStr(1, Ucase(cFields), "|" & Ucase(Mid(extenArr(i), 2)) & "|") > 0 Then oBoolean = oBoolean And True Else sErrors = sErrors & "表单[ " & itemName(i) & " ]的文件格式错误!n" & _ "支持的格式为:" & Replace(Mid(cFields, 2, Len(cFields) - 1), "|", " ") & "nn" oBoolean = oBoolean And False End If End If Next End If CheckFile = oBoolean End Function Private Function CreateFolder(byVal sLine, byVal sPath) Dim oFso Set oFso = Server.CreateObject("Scripting.FileSystemObject") If Not oFso.FolderExists(sPath) Then Dim regEx Set regEx = New RegExp regEx.Pattern = "^(.*)\([^\]*)$" regEx.Global = False regEx.IgnoreCase = True sLine = sLine & regEx.Replace(sPath, "$2") & "|" sPath = regEx.Replace(sPath, "$1") If CreateFolder(sLine, sPath) Then CreateFolder = True Set regEx = Nothing Else If sLine = "|" Then CreateFolder = True Else Dim sTemp : sTemp = Mid(sLine, 2, Len(sLine) - 2) If InStrRev(sTemp, "|") = 0 Then sLine = "|" sPath = sPath & "" & sTemp Else Dim Folder : Folder = Mid(sTemp, InStrRev(sTemp, "|") + 1) sLine = "|" & Mid(sTemp, 1, InStrRev(sTemp, "|") - 1) & "|" sPath = sPath & "" & Folder End If oFso.CreateFolder sPath If CreateFolder(sLine, sPath) Then CreateFolder = True End if End If Set oFso = Nothing End Function Function ParentFolder(byVal sPath) Dim regEx Set regEx = New RegExp regEx.Pattern = "^(.*)\[^\]*$" regEx.Global = True regEx.IgnoreCase = True ParentFolder = regEx.Replace(sPath, "$1") Set regEx = Nothing End Function Private Function StrToByte(byVal sText) For i = 1 To Len(sText) StrToByte = StrToByte & ChrB(Asc(Mid(sText, i, 1))) Next End Function Private Function ByteToStr(byVal sByte) Dim oStream Set oStream = Server.CreateObject("ADODB.Stream") oStream.Type = 2 oStream.Mode = 3 oStream.Open oStream.WriteText sByte oStream.Position = 0 oStream.CharSet = "gb2312" oStream.Position = 2 ByteToStr = oStream.ReadText oStream.Close Set oStream = Nothing End Function Private Function ItemToColl For i = 0 To itemCount - 1 If Not Form.Exists(itemName(i)) Then Form.Add itemName(i), itemData(i) End If Next End Function Private Sub Class_Terminate Form.RemoveAll Set Form = Nothing End Sub End Class If Request.ServerVariables("REQUEST_METHOD") = "POST" Then Rem 建立上传类实例 Set oUpload = New Upload Rem 指定允许上传文件的类型 oUpload.CheckFields = "|GIF|BMP|JPG|" Rem 指定上传文件所存储的相对路径 oUpload.Folder = "51JS.COM-ZMM/UploadFile" Rem 开始上传处理 oUpload.Start If oUpload.Finished Then Rem 上传成功,显示上传信息 Dim sHtml : sHtml = "" sHtml = sHtml & "" sHtml = sHtml & "" sHtml = sHtml & "上传表单数据 " sHtml = sHtml & "标题: " & oUpload.Form("P_title") & " " sHtml = sHtml & "类型: " & oUpload.Form("P_assort") & " " sHtml = sHtml & "小图: 服务器端路径:" & oUpload.Form("P_image_s") & " " sHtml = sHtml & "中图: 服务器端路径:" & oUpload.Form("P_image_m") & " " sHtml = sHtml & "大图: 服务器端路径:" & oUpload.Form("P_image_b") & " " sHtml = sHtml & "介绍: " & oUpload.Form("P_content") & " " sHtml = sHtml & "" sHtml = sHtml & "" Response.Write sHtml Response.End Else Rem 上传失败,显示错误信息 Call ShowMsg(oUpload.ErrMessage, Request.ServerVariables("SCRIPT_NAME")) End If Rem 对话框提示函数 Function ShowMsg(byVal sText, byVal sTarget) Dim sScript : sScript = "" sScript = sScript & "" Response.Write sScript Response.End End Function End If %> 多文件、表单混合上传类 body { margin: 0px; border: 0px; font-size: 10pt; } table { border-collapse: collapse; font-size: 10pt; } td { font-size: 10pt; } " method="post" enctype="multipart/form-data" onsubmit="return formCheck(this);"> 上传功能测试 标题: 类型: 电子 医疗 小图: 中图: 大图: 介绍: [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]8.TabPage类 body { background-color: menu; } #oContainer { width: 500px; height: 400px; } 标题: 来源: 分类: 计算机网络计算机软件 测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

  推荐阅读

  使用Modello编写JavaScript类

From:http://www.ajaxwing.com/index.php?id=2 一,背景 回顾一下编程语言的发展,不难发现这是一个不断封装的过程:从最开始的汇编语言,到面向过程语言,然后到面向对象语言,再到具备面向对象特性的脚本语言,>>>详细阅读


本文标题:写了几个类,希望对大家有用。

地址:http://www.17bianji.com/kaifa2/JS/31266.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)