::: ::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: function gfxSpex(flnm, width, height, depth, strImageType) dim strPNG dim strGIF dim strBmp dim strType strType = "" strImageType = "(unknown)" gfxSpex = False strPNG = chr(137) & chr(80) & chr(78) strGIF = "GIF" strBmp = chr(66) & chr(77) strType = GetBytes(flnm, 0, 3) if strType = strGIF then is GIF strImageType = "GIF" Width = lngConvert(GetBytes(flnm, 7, 2)) Height = lngConvert(GetBytes(flnm, 9, 2)) Depth = 2 ^ ((asc(GetBytes(flnm, 11, 1)) and 7) + 1) gfxSpex = True elseif left(strType, 2) = strBmp then is Bmp strImageType = "Bmp" Width = lngConvert(GetBytes(flnm, 19, 2)) Height = lngConvert(GetBytes(flnm, 23, 2)) Depth = 2 ^ (asc(GetBytes(flnm, 29, 1))) gfxSpex = True elseif strType = strPNG then Is PNG strImageType = "PNG" Width = lngConvert2(GetBytes(flnm, 19, 2)) Height = lngConvert2(GetBytes(flnm, 23, 2)) Depth = getBytes(flnm, 25, 2) select case asc(right(Depth,1)) case 0 Depth = 2 ^ (asc(left(Depth, 1))) gfxSpex = True case 2 Depth = 2 ^ (asc(left(Depth, 1)) * 3) gfxSpex = True case 3 Depth = 2 ^ (asc(left(Depth, 1))) 8 gfxSpex = True case 4 Depth = 2 ^ (asc(left(Depth, 1)) * 2) gfxSpex = True case 6 Depth = 2 ^ (asc(left(Depth, 1)) * 4) gfxS pex = True case else Depth = -1 end select
else strBuff = GetBytes(flnm, 0, -1) Get all bytes from file lngSize = len(strBuff) flgFound = 0 strTarget = chr(255) & chr(216) & chr(255) flgFound = instr(strBuff, strTarget) if flgFound = 0 then exit function end if strImageType = "JPG" lngPos = flgFound + 2 ExitLoop = false do while ExitLoop = False and lngPos < lngSize
do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize lngPos = lngPos + 1 loop if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2)) lngPos = lngPos + lngMarkerSize + 1 else ExitLoop = True end if loop
if ExitLoop = False then Width = -1 Height = -1 Depth = -1 else Height = lngConvert2(mid(strBuff, lngPos + 4, 2)) Width = lngConvert2(mid(strBuff, lngPos + 6, 2)) Depth = 2 ^ (asc(mid(strBuff, lngPos + 8, 1)) * 8) gfxSpex = True end if
end if end function
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::: Test Harness ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
To test, well just try to show all files with a .GIF extension in the root of C: Set objFSO = createObject("Scripting.FileSystemObject") Set objF = objFSO.GetFolder("c:\") Set objFC = objF.Files response.write "<table border=""0"" cellpadding=""5"">" For Each f1 in objFC if instr(ucase(f1.Name), ".GIF") then response.write "<tr><td>" & f1.name & "</td><td>" & f1.Datecreated & "</td><td>" & f1.Size & "</td><td>" if gfxSpex(f1.Path, w, h, c, strType) = true then response.write w & " x " & h & " " & c & " colors" else response.write " " end if response.write "</td></tr>" end if Next response.write "</table>" set objFC = nothing set objF = nothing set objFSO = nothing
%> 23.点击返回上页代码: <form> <p><input TYPE="button" value="返回上一步" onCLICK="history.back(-1)"></p> </form> 24.点击刷新代码㈠: <form> <p><input TYPE="button" value="刷新 按钮一" onCLICK="ReloadButton()"></p> </form> <script language="javascript"><!-- function ReloadButton(){location.href="allbutton.htm";}
24.点击刷新代码㈡: <form> <p><input TYPE="button" value="刷新按钮二" onClick="history.go(0)"> </p> </form>
<form> <p><input TYPE="button" value="打开一个网站" onCLICK="HomeButton()"></p> </form> <script language="javascript"><!-- function HomeButton(){location.href="http://nettrain.126.com";;;;} // --></script>
25.弹出警告框代码: <form> <p><input TYPE="button" value="弹出警告框" onCLICK="AlertButton()"></p> </form> <script language="javascript"><!-- function AlertButton(){window.alert("要多多光临呀!");} // --></script>
26.状态栏信息 <form> <p><input TYPE="button" value="状态栏信息" onCLICK="StatusButton()"></p> </form> <script language="javascript"><!-- function StatusButton(){window.status="要多多光临呀!";} // --></script>
27.背景色变换 <form> <p><input TYPE="button" value="背景色变换" onClick="BgButton()"></p> </form> <script>function BgButton(){ if (document.bgColor==#00ffff) {document.bgColor=#ffffff;} else{document.bgColor=#00ffff;} } </script>
28.点击打开新窗口 <form> <p><input TYPE="button" value="打开新窗口" onCLICK="NewWindow()"></p> </form> <script language="javascript"><!-- function NewWindow(){window.open("http://www.mcmx.com";;;,"","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");} // --></script></body> 29.分页代码: <%本程序文件名为:Pages.asp%> <%包含ADO常量表文件adovbs.inc,可从"\Program Files\Common Files\System\ADO"目录下拷贝%> <!--#Include File="adovbs.inc"--> <%*建立数据库连接,这里是Oracle8.05数据库 Set conn=Server.createObject("ADODB.Connection") conn.Open "Provider=msdaora.1;Data Source=YourSrcName;User ID=YourUserID;Password=YourPassword;"
Set rs=Server.createObject("ADODB.Recordset") 创建Recordset对象 rs.CursorLocation=adUseClient 设定记录集指针属性 *设定一页内的记录总数,可根据需要进行调整 rs.PageSize=10
*设置查询语句 StrSQL="select ID,姓名,住址,电话 from 通讯录 Order By ID" rs.Open StrSQL,conn,adOpenStatic,adLockReadOnly,adCmdText %> <HTML> <HEAD> <title>分页示例</title> <script language=javascript> //点击"[第一页]"时响应: function PageFirst() { document.MyForm.CurrentPage.selectedIndex=0; document.MyForm.CurrentPage.onchange(); } //点击"[上一页]"时响应: function PagePrior() { document.MyForm.CurrentPage.selectedIndex--; document.MyForm.CurrentPage.onchange(); } //点击"[下一页]"时响应: function PageNext() { document.MyForm.CurrentPage.selectedIndex++; document.MyForm.CurrentPage.onchange(); } //点击"[最后一页]"时响应: function PageLast() { document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1; document.MyForm.CurrentPage.onchange(); } //选择"第?页"时响应: function PageCurrent() { //Pages.asp是本程序的文件名 document.MyForm.action=Pages.asp?Page=+(document.MyForm.CurrentPage.selectedIndex+1) document.MyForm.submit(); } </Script> </HEAD> <BODY bgcolor="#ffffcc" link="#008000" vlink="#008000" alink="#FF0000"">
<%IF rs.Eof THEN Response.Write("<font size=2 color=#000080>[数据库中没有记录!]</font>") ELSE 指定当前页码 If Request("CurrentPage")="" Then rs.AbsolutePage=1 Else rs.AbsolutePage=CLng(Request("CurrentPage")) End If
创建表单MyForm,方法为Get Response.Write("<form method=Get name=MyForm>") Response.Write("<p align=center><font size=2 color=#008000>") 设置翻页超链接 if rs.PageCount=1 then Response.Write("[第一页] [上一页] [下一页] [最后一页] ") else if rs.AbsolutePage=1 then Response.Write("[第一页] [上一页] ") Response.Write("[<a href=java script:PageNext()>下一页</a>] ") Response.Write("[<a href=java script:PageLast()>最后一页</a>] ") else if rs.AbsolutePage=rs.PageCount then Response.Write("[<a href=java script:PageFirst()>第一页</a>] ") Response.Write("[<a href=java script:PagePrior()>上一页</a>] ") Response.Write("[下一页] [最后一页] ") else Response.Write("[<a href=java script:PageFirst()>第一页</a>] ") Response.Write("[<a href=java script:PagePrior()>上一页</a>] ") Response.Write("[<a href=java script:PageNext()>下一页</a>] ") Response.Write("[<a href=java script:PageLast()>最后一页</a>] ") end if end if end if 创建下拉列表框,用于选择浏览页码 Response.Write("第<select size=1 name=CurrentPage onchange=PageCurrent()>") For i=1 to rs.PageCount if rs.AbsolutePage=i then Response.Write("<option selected>"&i&"</option>") 当前页码 else Response.Write("<option>"&i&"</option>") end if Next Response.Write("</select>页/共"&rs.PageCount&"页 共"&rs.RecordCount&"条记录</font><p>") Response.Write("</form>")
创建表格,用于显示 Response.Write("<table align=center cellspacing=1 cellpadding=1 border=1") Response.Write(" bordercolor=#99CCFF bordercolordark=#b0e0e6 bordercolorlight=#000066>")
Response.Write("<tr bgcolor=#ccccff bordercolor=#000066>")
Set Columns=rs.Fields
显示表头 For i=0 to Columns.Count-1 Response.Write("<td align=center width=200 height=13>") Response.Write("<font size=2><b>"&Columns(i).name&"</b></font></td>") Next Response.Write("</tr>") 显示内容 For i=1 to rs.PageSize Response.Write("<tr bgcolor=#99ccff bordercolor=#000066>") For j=0 to Columns.Count-1 Response.Write("<td><font size=2>"&Columns(j)&"</font></t 上一页 [1] [2] [3] 下一页
|