HTML文件标记 <html> <head> <!--> <title> <body>
文字排版标记
HTML文件标记 <html> <head> <!--> <title> <body>
文字排版标记 <br/> <nobr> <p> <pre> 原始文字样式 <center> <blockquote> 向内缩排 <h> 标题 <strong>,<b> 粗体 <em>,<i>,<cite> 斜体 <U> 底线 <strike> 删除线 <blink> 文字闪烁 <big> 大型字体 <small> 小型字体 <sup> 文字上标 <SUB> 文字下标 <basefont> 默认字体设置 <font> 更改字体设置
菜单标记 <menu> 选项菜单 <dir> 目录菜单 <lh> 菜单格式(一) <ul> 菜单格式(二) <dl>,<dt>,<dd> 说明式菜单 <ol>,<li> 标题菜单
直线与表格标记 <hr> <table> <tr> <td> <th> <caption> 表格标题
超链接标记 <a> 锚
图形标记 <IMG> 插入图形
框架标记 <FRAME> 定义框架内容 <NOFRAME> 不支持框架声明
表单标记 <FORM> <INPUT> <TEXTAREA> <SELECT> <OPTION>
SCRIPT <script>
VBSCRIPT标记索引
基本运算 + 数字加法及字符串连接 - 数字减法 * 数字乘法 / 数字除法 Mod 求余数 \ 求商数 & 字符串连接 ^ 次方 = 相等 <> 不相等 >= 大于或等于 > 大于 <= 小于或等于 < 小于 Not 非 And 且 Or 或 Xor 异或
循环及决策 if ....then 若...则... if ...then...else 若...则...非 else if... 非若 select case... 群组选择条件 end select for ... next 计数循环 while...wend 条件循环(一) do while...loop 条件循环(二) do...loop while 条件循环(三) do until...loop 条件循环(四) do...loop until 条件循环(五)
数学函数 Abs 绝对值 Sgn 正负号 Hex 转换成十六进制 Oct 转换成八进制 Sqr 平方根 Int 取整数 Fix 取整数 Round 取整数 Log 以e为底的对数 Sin 正弦函数 Cos 余弦函数 Tan 正切函数
字符串处理函数 Len 字符串长度 Mid 取部分字符串 Left 从字符串开头取部分字符串 Right 从字符串结尾取部分字符串 Lcase 转换成小写 Ucase 转换成大写 Trim 清除字符串开头及结尾的空格符 Ltrim 清除字符串开头空格符 Rtrim 清除字符串结尾空格符 Replace 替换字符串部分字符 Instr 判断是否包含于另一个字符串(从起始搜寻) InstrRev 判断是否包含于另一个字符串(从结尾搜寻) Space 任意字符数的空格符 String 任意字符数的任一字符 StrReverse 反转字符串 Split 以某字符分割字符串
数据类型转换函数 Cint 转换成整形 Cstr 转换成字符串 Clng 转换成常整数 Cbool 转换成布尔函数 Cdate 转换成日期函数 CSng 转换成单精度 CDbl 转换成双精度
日期时间函数 Date 现在日期 Time 现在时间 NOw 现在日期时间 DateAdd 增加日期 DateDiff 两日期差 DateSerial 日期设定 DateValue 日期设定 Year 现在年份 Month 现在月份 Day 现在天 Hour 现在时刻 Minute 现在分钟 Second 现在秒钟 Timer 午夜距现在秒数 TimeSerial 时间设定 TimeValue 时间所属部分 WeekDay 星期名称 MonthName 月份名称
其它函数 Array 产生数组 Asc 字符ASCII码 Chr ASCII码字符 Filter 过滤数组 InputBox 输入窗口 Join 合并数组中的元素 MsgBox 信息窗口 Lbound 数组下界 Ubound 数组上界
指令 Const 设定常数 Dim 定义变量或者数组 Erase 清除数组 ReDim 重新声明数组 Randomize 起始随机数 Rnd 取得随机数
ASP对象
Session对象 IsEmpty 测试Session变量是否存在 TimeOut 设定Session变量生存周期 Abandon 强制清除Session变量
Application对象 IsEmpty 测试Application变量是否存在 Lock 锁定Application变量 Unlock 解除Lock指令的锁定
Cookies对象 Expires 设定Cookies变量的生存周期
Connection对象 Open 打开与数据库的连接 Execute 打开Recordset对象 Close 关闭Connection对象
Recordset对象 movefirst 将记录指针移至第一条 movelast 将记录指针移至最后一条 movenext 将记录指针移至下一条 moveprevious 将记录指针移至上一条 bof 测试是否为recordset的起始 eof 测试是否为recordset的结束 open 打开Recoreset对象 close 关闭recordset对象 fields 读取数据的子对象 fileds.count 字段个数 pagesize 每页记录条数 absolutepage 设定为某页 pagecount 总页数 Absoluteposition 直接跳至某条记录
没什么好共享的,但太感动了,把做树型菜单的js函数贴出来, <SCRIPT language="JavaScript"> var lastObj
function expandIt(obj) { if(lastObj != null) { if(obj == lastObj) { if(obj.style.display == "none") { obj.style.display = ""; } else { obj.style.display = "none" } } else { lastObj.style.display = "none"; obj.style.display = ""; } } else { obj.style.display = ""; }
lastObj = obj } </SCRIPT>
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <% dim id id = request("id") dim strsql,rs
strsql="select * from p_type where slanguage=1 and typelevel=1 order by typename" set rs=fgetrslist(strsql) do while not rs.eof
%> <tr> <td height="25" class="LEFTLINKS"><img width="30" height="0" align="absmiddle" /><b><%if rs("isleaf")=0 then%><a href="#" onClick="javascript:expandIt(kb<%=rs("id")%>);return false"><%else%><a href="<%=request.ServerVariables("SCRIPT_NAME")%>?idtree=<%=rs("idtree")%>" ><%end if%><%=server.HTMLEncode(right((rs("typename")&""),len(rs("typename")&"")-2))%></a></b></td> </tr> <% IF clng(id)=clng(rs("id")) then
%> <tr id="kb<%=rs("id")%>"> <% else
%>
<tr id="kb<%=rs("id")%>" style="display:none;"> <% end if %> <td> <table> <% dim rs1 strsql="select * from p_type where parentid="&rs("id")&" and slanguage=1 order by typename" set rs1=fgetrslist(strsql) do while not rs1.eof %> <tr><td height="20" class="LEFTLINKS"> <img width="40" height="0" align="absmiddle" /><a href="<%=request.ServerVariables("SCRIPT_NAME")%>?idtree=<%=rs1("idtree")%>&id=<%=rs("id")%>" ><%=server.HTMLEncode(right((rs1("typename")&""),len(rs1("typename")&"")-2))%></a></td></tr> <% rs1.movenext loop rs1.close set rs1=nothing %> </table> </td> </tr> <% rs.movenext
loop rs.close set rs=nothing %> </table>
计算网页文本的汉字字数,去掉了表格以外的所有标识。 Function GetLength(strChinese1) Dim strWord, ascWord, lenTotal strChinese1 = Trim(strChinese1)
If strChinese1 = "" Or Vartype(strChinese1) = vbNull Then GetLength = 0 Exit Function End If
lenTotal = 0 For GetLengthi=1 to Len(strChinese1) strWord = Mid(strChinese1, GetLengthi, 1) ascWord = Asc(strWord) If ascWord < 0 or ascWord > 127 then lenTotal = lenTotal + 1 Elseif ascWord = 63 And strWord <> "?" then lenTotal = lenTotal + 1 Elseif ascWord = 44 And strWord <> "," then lenTotal = lenTotal + 1 Elseif ascWord = 33 And strWord <> "!" then lenTotal = lenTotal + 1 Else lenTotal = lenTotal End If Next
GetLength = lenTotal End Function
昨天有人问MicrosoftVBscript运行时错误的全部列表,我给他回了vbscript帮助里面的错误列表,回来自己用Err.Raise做了个编历的小程序,发现给人家发的不全,再想贴却发现有限制,连续不能发三贴以上。。郁闷
MicrosoftVBscript运行时错误(完整版)共121个
MicrosoftVBscript运行时错误(0x000A0005) 无效的过程调用或参数 MicrosoftVBscript运行时错误(0x000A0005) 无效的过程调用或参数 MicrosoftVBscript运行时错误(0x000A0006) 溢出 MicrosoftVBscript运行时错误(0x000A0007) 内存不够 MicrosoftVBscript运行时错误(0x000A0009) 下标越界 MicrosoftVBscript运行时错误(0x000A000A) 该数组为定长的或临时被锁定 MicrosoftVBscript运行时错误(0x000A000B) 被零除 MicrosoftVBscript运行时错误(0x000A000D) 类型不匹配 MicrosoftVBscript运行时错误(0x000A000E) 字符串空间不够 MicrosoftVBscript运行时错误(0x000A0011) 不能执行所需的操作 MicrosoftVBscript运行时错误(0x000A001C) 堆栈溢出 MicrosoftVBscript运行时错误(0x000A0023) 未定义过程或函数 MicrosoftVBscript运行时错误(0x000A0030) 加载 DLL 时出错 MicrosoftVBscript运行时错误(0x000A0033) 内部错误 MicrosoftVBscript运行时错误(0x000A0034) 错误的文件名或号码 MicrosoftVBscript运行时错误(0x000A0035) 文件未找到 MicrosoftVBscript运行时错误(0x000A0036) 错误的文件模式 MicrosoftVBscript运行时错误(0x000A0037) 文件已经打开 MicrosoftVBscript运行时错误(0x000A0039) 设备 I/O 错误 MicrosoftVBscript运行时错误(0x000A003A) 文件已存在 MicrosoftVBscript运行时错误(0x000A003D) 磁盘已满 MicrosoftVBscript运行时错误(0x000A003E) 输入超出了文件尾 MicrosoftVBscript运行时错误(0x000A0043) 文件过多 MicrosoftVBscript运行时错误(0x000A0044) 设备不可用 MicrosoftVBscript运行时错误(0x000A0046) 没有权限 MicrosoftVBscript运行时错误(0x000A0047) 磁盘没有准备好 MicrosoftVBscript运行时错误(0x000A004A) 重命名时不能带有其他驱动器符号 MicrosoftVBscript运行时错误(0x000A004B) 路径/文件访问错误 MicrosoftVBscript运行时错误(0x000A004C) 路径未找到 MicrosoftVBscript运行时错误(0x000A005B) 对象变量未设置 MicrosoftVBscript运行时错误(0x000A005C) For 循环未初始化 MicrosoftVBscript运行时错误(0x000A005E) 无效使用 Null MicrosoftVBscript运行时错误(0x000A0142) 不能创建必要的临时文件 MicrosoftVBscript运行时错误(0x000A01A8) 缺少对象 MicrosoftVBscript运行时错误(0x000A01AD) ActiveX 部件不能创建对象 MicrosoftVBscript运行时错误(0x000A01AE) 类不支持 Automation 操作 MicrosoftVBscript运行时错误(0x000A01B0) Automation 操作中文件名或类名未找到 MicrosoftVBscript运行时错误(0x000A01B6) 对象不支持此属性或方法 MicrosoftVBscript运行时错误(0x000A01B8) Automation 操作错误 MicrosoftVBscript运行时错误(0x000A01BD) 对象不支持此操作 MicrosoftVBscript运行时错误(0x000A01BE) 对象不支持已命名参数 MicrosoftVBscript运行时错误(0x000A01BF) 对象不支持当前区域设置选项 MicrosoftVBscript运行时错误(0x000A01C0) 未找到已命名参数 MicrosoftVBscript运行时错误(0x000A01C1) 参数是必选项 MicrosoftVBscript运行时错误(0x000A01C2) 错误的参数个数或无效的参数属性值 MicrosoftVBscript运行时错误(0x000A01C3) 对象不是一个集合 MicrosoftVBscript运行时错误(0x000A01C5) 未找到指定的 DLL 函数 MicrosoftVBscript运行时错误(0x000A01C7) 代码资源锁定错误 MicrosoftVBscript运行时错误(0x000A01C9) 此键已与该集合的一个元素关联 MicrosoftVBscript运行时错误(0x000A01CA) 变量使用了一个 VBScript 中不支持的 Automation 类型 MicrosoftVBscript运行时错误(0x000A01CE) 远程服务器不存在或不可用 MicrosoftVBscript运行时错误(0x000A01E1) 无效图片 MicrosoftVBscript运行时错误(0x000A01F4) 变量未定义 MicrosoftVBscript运行时错误(0x000A01F5) 非法赋值 MicrosoftVBscript运行时错误(0x000A01F6) 对象不能安全用 Script 编程 MicrosoftVBscript运行时错误(0x000A01F7) 对象不能安全初始化 MicrosoftVBscript运行时错误(0x000A01F8) 对象不能安全创建 MicrosoftVBscript运行时错误(0x000A01F9) 无效的或无资格的引用 MicrosoftVBscript运行时错误(0x000A01FA) 类没有被定义 MicrosoftVBscript运行时错误(0x000A01FB) 出现一个意外错误 MicrosoftVBscript运行时错误(0x000A03E9) 内存不够 MicrosoftVBscript运行时错误(0x000A03EA) 语法错误 MicrosoftVBscript运行时错误(0x000A03EB) 缺少 ‘:‘ MicrosoftVBscript运行时错误(0x000A03ED) 缺少 ‘(‘ MicrosoftVBscript运行时错误(0x000A03EE) 缺少 ‘)‘ MicrosoftVBscript运行时错误(0x000A03EF) 缺少 ‘]‘ MicrosoftVBscript运行时错误(0x000A03F2) 缺少标识符 MicrosoftVBscript运行时错误(0x000A03F3) 缺少 ‘=‘ MicrosoftVBscript运行时错误(0x000A03F4) 缺少 ‘If‘ MicrosoftVBscript运行时错误(0x000A03F5) 缺少 ‘To‘ MicrosoftVBscript运行时错误(0x000A03F6) 缺少 ‘End‘ MicrosoftVBscript运行时错误(0x000A03F7) 缺少 ‘Function‘ MicrosoftVBscript运行时错误(0x000A03F8) 缺少 ‘Sub‘ MicrosoftVBscript运行时错误(0x000A03F9) 缺少 ‘Then‘ MicrosoftVBscript运行时错误(0x000A03FA) 缺少 ‘Wend‘ MicrosoftVBscript运行时错误(0x000A03FB) 缺少 ‘Loop‘ MicrosoftVBscript运行时错误(0x000A03FC) 缺少 ‘Next‘ MicrosoftVBscript运行时错误(0x000A03FD) 缺少 ‘Case‘ MicrosoftVBscript运行时错误(0x000A03FE) 缺少 ‘Select‘ MicrosoftVBscript运行时错误(0x000A03FF) 缺少表达式 MicrosoftVBscript运行时错误(0x000A0400) 缺少语句 MicrosoftVBscript运行时错误(0x000A0401) 语句未结束 MicrosoftVBscript运行时错误(0x000A0402) 缺少整型常数 MicrosoftVBscript运行时错误(0x000A0403) 缺少 ‘While‘ 或 ‘Until‘ MicrosoftVBscript运行时错误(0x000A0404) 缺少 ‘While‘ 和 ‘Until‘或语句未结束 MicrosoftVBscript运行时错误(0x000A0405) 缺少 ‘With‘ MicrosoftVBscript运行时错误(0x000A0406) 标识符过长 MicrosoftVBscript运行时错误(0x000A0407) 无效数字 MicrosoftVBscript运行时错误(0x000A0408) 无效字符 MicrosoftVBscript运行时错误(0x000A0409) 未结束的字符串常量 MicrosoftVBscript运行时错误(0x000A040A) 注释未结束 MicrosoftVBscript运行时错误(0x000A040D) 无效使用 ‘Me‘ 关键字 MicrosoftVBscript运行时错误(0x000A040E) ‘loop‘ 语句缺少 ‘do‘ MicrosoftVBscript运行时错误(0x000A040F) 无效的 ‘exit‘ 语句 MicrosoftVBscript运行时错误(0x000A0410) 循环控制变量 ‘for‘ 无效 MicrosoftVBscript运行时错误(0x000A0411) 名称重定义 MicrosoftVBscript运行时错误(0x000A0412) 必须是行中的第一个语句 MicrosoftVBscript运行时错误(0x000A0413) 不能为 non-ByVal 参数赋值 MicrosoftVBscript运行时错误(0x000A0414) 调用子程序时不能使用括号 MicrosoftVBscript运行时错误(0x000A0415) 缺少文字常数 MicrosoftVBscript运行时错误(0x000A0416) 缺少 ‘In‘ MicrosoftVBscript运行时错误(0x000A0417) 缺少 ‘Class‘ MicrosoftVBscript运行时错误(0x000A0418) 必须在一个类的内部定义 MicrosoftVBscript运行时错误(0x000A0419) 在属性声明中缺少 Let , Set 或 Get MicrosoftVBscript运行时错误(0x000A041A) 缺少 ‘Property‘ MicrosoftVBscript运行时错误(0x000A041B) 在所有属性的规范中,变量的数目必须一致 MicrosoftVBscript运行时错误(0x000A041C) 在一个类中不允许有多个缺省的属性/方法 MicrosoftVBscript运行时错误(0x000A041D) 类的初始化或终止程序没有变量 MicrosoftVBscript运行时错误(0x000A041E) 属性的 set 或 let 必须至少有一个变量 MicrosoftVBscript运行时错误(0x000A041F) 错误的 ‘Next‘ MicrosoftVBscript运行时错误(0x000A0420) ‘Default‘ 只能在 ‘Property‘ , ‘Function‘ 或 ‘Sub‘ 中指定 MicrosoftVBscript运行时错误(0x000A0421) 指定 ‘Default‘ 时必须同时指定 ‘Public‘ MicrosoftVBscript运行时错误(0x000A0422) 只能在 Property Get 中指定 ‘Default‘ MicrosoftVBscript运行时错误(0x000A1000) Microsoft VBScript 编译器错误 MicrosoftVBscript运行时错误(0x000A1001) Microsoft VBScript 运行时错误 MicrosoftVBscript运行时错误(0x000A1398) 缺少正则表达式对象 MicrosoftVBscript运行时错误(0x000A1399) 正则表达式语法错误 MicrosoftVBscript运行时错误(0x000A139A) 错误的数量词 MicrosoftVBscript运行时错误(0x000A139B) 正则表达式中缺少 ‘]‘ MicrosoftVBscript运行时错误(0x000A139C) 正则表达式中缺少 ‘)‘ MicrosoftVBscript运行时错误(0x000A139D) 字符集越界
10进制表示,希望actor2222 (优悠) 能看到
MicrosoftVBscript运行时错误列表(10进制表示)
error # 5 无效的过程调用或参数 error # 5 无效的过程调用或参数 error # 6 溢出 error # 7 内存不够 error # 9 下标越界 error # 10 该数组为定长的或临时被锁定 error # 11 被零除 error # 13 类型不匹配 error # 14 字符串空间不够 error # 17 不能执行所需的操作 error # 28 堆栈溢出 error # 35 未定义过程或函数 error # 48 加载 DLL 时出错 error # 51 内部错误 error # 52 错误的文件名或号码 error # 53 文件未找到 error # 54 错误的文件模式 error # 55 文件已经打开 error # 57 设备 I/O 错误 error # 58 文件已存在 error # 61 磁盘已满 error # 62 输入超出了文件尾 error # 67 文件过多 error # 68 设备不可用 error # 70 没有权限 error # 71 磁盘没有准备好 error # 74 重命名时不能带有其他驱动器符号 error # 75 路径/文件访问错误 error # 76 路径未找到 error # 91 对象变量未设置 error # 92 For 循环未初始化 error # 94 无效使用 Null error # 322 不能创建必要的临时文件 error # 424 缺少对象 error # 429 ActiveX 部件不能创建对象 error # 430 类不支持 Automation 操作 error # 432 Automation 操作中文件名或类名未找到 error # 438 对象不支持此属性或方法 error # 440 Automation 操作错误 error # 445 对象不支持此操作 error # 446 对象不支持已命名参数 error # 447 对象不支持当前区域设置选项 error # 448 未找到已命名参数 error # 449 参数是必选项 error # 450 错误的参数个数或无效的参数属性值 error # 451 对象不是一个集合 error # 453 未找到指定的 DLL 函数 error # 455 代码资源锁定错误 error # 457 此键已与该集合的一个元素关联 error # 458 变量使用了一个 VBScript 中不支持的 Automation 类型 error # 462 远程服务器不存在或不可用 error # 481 无效图片 error # 500 变量未定义 error # 501 非法赋值 error # 502 对象不能安全用 Script 编程 error # 503 对象不能安全初始化 error # 504 对象不能安全创建 error # 505 无效的或无资格的引用 error # 506 类没有被定义 error # 507 出现一个意外错误 error # 1001 内存不够 error # 1002 语法错误 error # 1003 缺少 ‘:‘ error # 1005 缺少 ‘(‘ error # 1006 缺少 ‘)‘ error # 1007 缺少 ‘]‘ error # 1010 缺少标识符 error # 1011 缺少 ‘=‘ error # 1012 缺少 ‘If‘ error # 1013 缺少 ‘To‘ error # 1014 缺少 ‘End‘ error # 1015 缺少 ‘Function‘ error # 1016 缺少 ‘Sub‘ error # 1017 缺少 ‘Then‘ error # 1018 缺少 ‘Wend‘ error # 1019 缺少 ‘Loop‘ error # 1020 缺少 ‘Next‘ error # 1021 缺少 ‘Case‘ error # 1022 缺少 ‘Select‘ error # 1023 缺少表达式 error # 1024 缺少语句 error # 1025 语句未结束 error # 1026 缺少整型常数 error # 1027 缺少 ‘While‘ 或 ‘Until‘ error # 1028 缺少 ‘While‘ 和 ‘Until‘或语句未结束 error # 1029 缺少 ‘With‘ error # 1030 标识符过长 error # 1031 无效数字 error # 1032 无效字符 error # 1033 未结束的字符串常量 error # 1034 注释未结束 error # 1037 无效使用 ‘Me‘ 关键字 error # 1038 ‘loop‘ 语句缺少 ‘do‘ error # 1039 无效的 ‘exit‘ 语句 error # 1040 循环控制变量 ‘for‘ 无效 error # 1041 名称重定义 error # 1042 必须是行中的第一个语句 error # 1043 不能为 non-ByVal 参数赋值 error # 1044 调用子程序时不能使用括号 error # 1045 缺少文字常数 error # 1046 缺少 ‘In‘ error # 1047 缺少 ‘Class‘ error # 1048 必须在一个类的内部定义 error # 1049 在属性声明中缺少 Let , Set 或 Get error # 1050 缺少 ‘Property‘ error # 1051 在所有属性的规范中,变量的数目必须一致 error # 1052 在一个类中不允许有多个缺省的属性/方法 error # 1053 类的初始化或终止程序没有变量 error # 1054 属性的 set 或 let 必须至少有一个变量 error # 1055 错误的 ‘Next‘ error # 1056 ‘Default‘ 只能在 ‘Property‘ , ‘Function‘ 或 ‘Sub‘ 中指定 error # 1057 指定 ‘Default‘ 时必须同时指定 ‘Public‘ error # 1058 只能在 Property Get 中指定 ‘Default‘ error # 4096 Microsoft VBScript 编译器错误 error # 4097 Microsoft VBScript 运行时错误 error # 5016 缺少正则表达式对象 error # 5017 正则表达式语法错误 error # 5018 错误的数量词 error # 5019 正则表达式中缺少 ‘]‘ error # 5020 正则表达式中缺少 ‘)‘ error # 5021 字符集越界
利用ASP获得图象的实际尺寸的示例 <!--#include virtual="/learn/test/lib_graphicdetect.asp"--> <html><head> <TITLE>dbtable.asp</TITLE> </head> <body bgcolor="#FFFFFF"> <% graphic="images/learnaspiconmain.gif" HW = ReadImg(graphic) Response.Write graphic & " Dimensions: " & HW(0) & "x" & HW(1) & "<br/>" response.write "<img src=""/" & graphic & """" response.write height=""" & HW(0) & """ response.write width=""" & HW(0) & "">" %> </body></html>
The library that is included is:
<% Dim HW
Function AscAt(s, n) AscAt = Asc(Mid(s, n, 1)) End Function
Function HexAt(s, n) HexAt = Hex(AscAt(s, n)) End Function
Function isJPG(fichero) If inStr(uCase(fichero), ".JPG") <> 0 Then isJPG = true Else isJPG = false End If End Function
Function isPNG(fichero) If inStr(uCase(fichero), ".PNG") <> 0 Then isPNG = true Else isPNG = false End If End Function
Function isGIF(fichero) If inStr(uCase(fichero), ".GIF") <> 0 Then isGIF = true Else isGIF = false End If End Function
Function isBMP(fichero) If inStr(uCase(fichero), ".BMP") <> 0 Then isBMP = true Else isBMP = false End If End Function
Function isWMF(fichero) If inStr(uCase(fichero), ".WMF") <> 0 Then isWMF = true Else isWMF = false End If End Function
Function isWebImg(f) If isGIF(f) Or isJPG(f) Or isPNG(f) Or isBMP(f) Or isWMF(f) Then isWebImg = true Else isWebImg = true End If End Function
Function ReadImg(fichero) If isGIF(fichero) Then ReadImg = ReadGIF(fichero) Else If isJPG(fichero) Then ReadImg = ReadJPG(fichero) Else If isPNG(fichero) Then ReadImg = ReadPNG(fichero) Else If isBMP(fichero) Then ReadImg = ReadPNG(fichero) Else If isWMF(fichero) Then ReadImg = ReadWMF(fichero) Else ReadImg = Array(0,0) End If End If End If End If End If End Function
Function ReadJPG(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(167), 4) HW(0) = HexToDec(HexAt(s,3) & HexAt(s,4)) HW(1) = HexToDec(HexAt(s,1) & HexAt(s,2)) ts.Close ReadJPG = HW End Function
Function ReadPNG(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(24), 8) HW(0) = HexToDec(HexAt(s,3) & HexAt(s,4)) HW(1) = HexToDec(HexAt(s,7) & HexAt(s,8)) ts.Close ReadPNG = HW End Function
Function ReadGIF(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(10), 4) HW(0) = HexToDec(HexAt(s,2) & HexAt(s,1)) HW(1) = HexToDec(HexAt(s,4) & HexAt(s,3)) ts.Close ReadGIF = HW End Function
Function ReadWMF(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(14), 4) HW(0) = HexToDec(HexAt(s,2) & HexAt(s,1)) HW(1) = HexToDec(HexAt(s,4) & HexAt(s,3)) ts.Close ReadWMF = HW End Function
Function ReadBMP(fichero) Dim fso, ts, s, HW, nbytes HW = Array("","") Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(Server.MapPath("/" & fichero), 1) s = Right(ts.Read(24), 8) HW(0) = HexToDec(HexAt(s,4) & HexAt(s,3)) HW(1) = HexToDec(HexAt(s,8) & HexAt(s,7)) ts.Close ReadBMP = HW End Function
Function isDigit(c) If inStr("0123456789", c) <> 0 Then isDigit = true Else isDigit = false End If End Function
Function isHex(c) If inStr("0123456789ABCDEFabcdef", c) <> 0 Then isHex = true Else ishex = false End If End Function
Function HexToDec(cadhex) Dim n, i, ch, decimal decimal = 0 n = Len(cadhex) For i=1 To n ch = Mid(cadhex, i, 1) If isHex(ch) Then decimal = decimal * 16 If isDigit(c) Then decimal = decimal + ch Else decimal = decimal + Asc(uCase(ch)) - Asc("A") End If Else HexToDec = -1 End If Next HexToDec = decimal End Function %>
常用的javascript function file://========================================= // 输入数据检验 // 检验空值 function funCheckEmpty(m_Text) { var strTmp=m_Text if (strTmp == null || strTmp == "") { return false } return true }
file://检验内容的长度 function funTextLenCheck(m_Text) { var strText=m_Text for(i=0;i<=strText.length-1;i++){ if (strText.charCodeAt(i)>=256){ return strText.length * 2 } } return strText.length }
file://检验长度 function funCheckLen(m_Len,m_Text) { if (funTextLenCheck(m_Text)> m_Len) { return false } return true }
file://检验是否为数字 function funCheckNumber(m_Text) { var strTmp=m_Text if (isNaN(strTmp)) { return false } return true }
file://检验日期是否合法 function funcheckDate(m_Year,m_Month,m_Day){ file://根据月先取得最大日期 var maxDay if (m_Month==2) { maxDay=28 if (m_Year % 4 ==0) { maxDay=29 } } else { if (m_Month<=7){ if (m_Month % 2 ==0){ maxDay=30 }else{ maxDay=31 } }else{ if (m_Month % 2 ==0){ maxDay=31 }else{ maxDay=30 } } } if (m_Day>maxDay){ return false } return true }
file://读取Cookies信息 function GetCookie(strCookName){ var arvCookies=document.cookie.split("; ") for(var i=0;i< arvCookies.length; i++) { var arvOneCookie=arvCookies[i].split("=") if (strCookName==arvOneCookie[0]){ return unescape(arvOneCookie[1]) } } return "" }
file://替换字符串中的非法字符 function Replace_Text(text){ var strTmp=text strTmp=strTmp.replace("@", "@") strTmp=strTmp.replace("?", "?") strTmp=strTmp.replace("&", "&") strTmp=strTmp.replace("‘", "‘") strTmp=strTmp.replace("<", "〈") strTmp=strTmp.replace(">", "〉") return strTmp
}
function Check_PassWord(text){ var strTmp=text if (strTmp.indexOf("‘")>-1){ return "‘" } if (strTmp.indexOf("?")>-1){ return "?" } if (strTmp.indexOf("&")>-1){ return "&" } if (strTmp.indexOf("<")>-1){ return "<" } if (strTmp.indexOf(">")>-1){ return ">" } return ""
}
function Check_Url(text){ var strTmp=text if (strTmp.indexOf("‘")>-1){ return false } return true }
file://焦点控制 function document.onkeydown(){ var e = event.srcElement; if (event.keyCode == 13 && e.tagName == "INPUT" && e.type == "text"){ event.keyCode = 9; }
}
<% response.write " 1.oncontextmenu="window.event.returnvalue=false"将彻底屏蔽鼠标右键 <tableborderoncontextmenu=return(false)><td>no</table>可用于table 2.<bodyonselectstart="returnfalse">取消选取、防止复制 3.onpaste="returnfalse"不准粘贴 4.oncopy="returnfalse;"oncut="returnfalse;"防止复制 5.<linkrel="shortcuticon"href="favicon.ico">ie地址栏前换成自己的图标 6.<linkrel="bookmark"href="favicon.ico">可以在收藏夹中显示出你的图标 7.<inputstyle="ime-mode:disabled">关闭输入法 8.永远都会带着框架 <scriptlanguage="javascript"><!-- if(window==top)top.location.href="frames.htm";//frames.htm为框架网页 file://--></script> 9.防止被人frame <scriptlanguage=javascript><!-- if(top.location!=self.location)top.location=self.location; file://--></script> 10.<noscript><iframesrc=*.html></iframe></noscript>网页将不能被另存为 11.<inputtype=buttonvalue=查看网页源代码 onclick="window.location=view-source:+<img src="pic/url.gif" align=absmiddle border=0> http://www.csdn.net/";;;;> 12.怎样通过asp的手段来检查来访者是否用了代理 <%ifrequest.servervariables("http_x_forwarded_for")<>""then response.write"<fontcolor=#ff0000>您通过了代理服务器,"&_ "真实的ip为"&request.servervariables("http_x_forwarded_for") endif "%> <% response.write" 13.取得控件的绝对位置 file://javascript <scriptlanguage="javascript"> functiongetie(e){ vart=e.offsettop; varl=e.offsetleft; while(e=e.offsetparent){ t+=e.offsettop; l+=e.offsetleft; } alert("top="+t+"\nleft="+l); } </script> file://vbscript <scriptlanguage="vbscript"><!-- functiongetie() dimt,l,a,b seta=document.all.img1 t=document.all.img1.offsettop l=document.all.img1.offsetleft whilea.tagname<>"body" seta=a.offsetparent t=t+a.offsettop l=l+a.offsetleft wend msgbox"top="&t&chr(13)&"left="&l,64,"得到控件的位置" endfunction --></script> 14.光标是停在文本框文字的最后 <scriptlanguage="javascript"> functioncc() { vare=event.srcelement; varr=e.createtextrange(); r.movestart(character,e.value.length); r.collapse(true); r.select(); } </script> <inputtype=textname=text1value="123"onfocus="cc()"> 15.判断上一页的来源 asp: request.servervariables("http_referer") java script: document.referrer 16.最小化、最大化、关闭窗口 <objectid=hh1classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <paramname="command"value="minimize"></object> <objectid=hh2classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <paramname="command"value="maximize"></object> <objectid=hh3classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <paramname="command"value="close"></object> <inputtype=buttonvalue=最小化onclick=hh1.click()> <inputtype=buttonvalue=最大化onclick=hh2.click()> <inputtype=buttonvalue=关闭onclick=hh3.click()> 本例适用于ie 17. <% 定义数据库连接的一些常量 constadopenforwardonly=0游标只向前浏览记录,不支持分页、recordset、bookmark constadopenkeyset=1键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页、recordset、bookmark constadopendynamic=2动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏览(access不支持)。 constadopenstatic=3静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移动 constadlockreadonly=1锁定类型,默认的,只读,不能作任何修改 constadlockpessimistic=2当编辑时立即锁定记录,最安全的方式 constadlockoptimistic=3只有在调用update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等 constadlockbatchoptimistic=4当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的 constadcmdtext=&h0001 constadcmdtable=&h0002 " %> 18.网页不会被缓存 htm网页 <metahttp-equiv="pragma"content="no-cache"> <metahttp-equiv="cache-control"content="no-cache,must-revalidate"> <metahttp-equiv="expires"content="wed,26feb199708:21:57gmt"> 或者<metahttp-equiv="expires"content="0"> asp网页 response.expires=-1 response.expiresabsolute=now()-1 response.cachecontrol="no-cache" php网页 header("expires:mon,26jul199705:00:00gmt"); header("cache-control:no-cache,must-revalidate"); header("pragma:no-cache");
19.检查一段字符串是否全由数字组成 <scriptlanguage="javascript"><!-- functionchecknum(str){returnstr.match(/\d/)==null} alert(checknum("1232142141")) alert(checknum("123214214a1")) file://--></script> 20.获得一个窗口的大小 document.body.clientwidth,document.body.clientheight
21.怎么判断是否是字符 if(/[^\x00-\xff]/g.test(s))alert("含有汉字"); elsealert("全是字符"); 22.textarea自适应文字行数的多少 <textarearows=1 name=s1 cols=27 onpropertychange="this.style.posheight=this.scrollheight"> </textarea> 23.日期减去天数等于第二个日期 <scriptlanguage=javascript> functioncc(dd,dadd) { file://可以加上错误处理 vara=newdate(dd) a=a.valueof() a=a-dadd*24*60*60*1000 a=newdate(a) alert(a.getfullyear()+"年"+(a.getmonth()+1)+"月"+a.getdate()+"日") } cc("12/23/2002",2) </script> 24.选择了哪一个radio <html><scriptlanguage="vbscript"> functioncheckme() foreachobinradio1 ifob.checkedthenwindow.alertob.value next endfunction </script><body> <input name="radio1" type="radio" value="style" checked>style <input name="radio1" type="radio" value="barcode">barcode <input type="button" value="check"onclick="checkme()"> </body></html> 25.获得本页url的request.servervariables("")集合 response.write"<tableborder=1><!--tableheader--><tr><td><b>variables</b></td><td><b>value</b></td></tr>" foreachobinrequest.servervariables response.write"<tr><td>"&ob&"</td><td>"&request.servervariables(ob)&"</td></tr>" next response.write"</table>" 26. 本机ip<%=request.servervariables("remote_addr")%> 服务器名<%=request.servervariables("server_name")%> 服务器ip<%=request.servervariables("local_addr")%> 服务器端口<%=request.servervariables("server_port")%> 服务器时间<%=now%> iis版本<%=request.servervariables"server_software")%> 脚本超时时间<%=server.scripttimeout%> 本文件路径<%=server.mappath(request.servervariables("script_name"))%> 服务器cpu数量<%=request.servervariables("number_of_processors")%> 服务器解译引擎<%=scriptengine&"/" & scriptenginemajorversion &"." & scriptengineminorversion & "." & scriptenginebuildversion%> 服务器操作系统<%=request.servervariables("os")%> 27.enter键可以让光标移到下一个输入框 <input onkeydown="if(event.keycode==13)event.keycode=9"> 28.检测某个网站的链接速度: 把如下代码加入<body>区域中: <scriptlanguage=javascript> tim=1 setinterval("tim++",100) b=1 varautourl=newarray() autourl[1]="< src="pic/url.gif" align=absmiddle border=0> www." autourl[2]="javacool.3322.net" autourl[3]="< src="pic/url.gif" align=absmiddle border=0> www.sina.com.cn" autourl[4]="www.nuaa.edu.cn" autourl[5]="< src="pic/url.gif" align=absmiddle border=0> www.cctv.com" functionbutt(){ document.write("<formname=autof>") for(vari=1;i<autourl.length;i++) document.write("<inputtype=textname=txt"+i+"size=10value=测试中......>=》<inputtype=textname=url"+i+"size=40>=》<inputtype=buttonvalue=goonclick=window.open(this.form.url"+i+".value)><br/>") document.write("<inputtype=submitvalue=刷新></form>") } butt() functionauto(url){ document.forms[0]["url"+b].value=url if(tim>200) {document.forms[0]["txt"+b].value="链接超时"} else {document.forms[0]["txt"+b].value="时间"+tim/10+"秒"} b++ } functionrun(){for(vari=1;i<autourl.length;i++)document.write("<imgsrc=http://"+autourl+"/"+math.random()+"width=1height=1onerror=auto(< src="pic/url.gif" align=absmiddle border=0> ")}/">http://";;;;;+autourl+")>")} run()</script>
29.各种样式的光标 auto:标准光标 default:标准箭头 hand:手形光标 wait:等待光标 text:i形光标 vertical-text:水平i形光标 no-drop:不可拖动光标 not-allowed:无效光标 help:?帮助光标 all-scroll:三角方向标 move:移动标 crosshair:十字标 e-resize n-resize nw-resize w-resize s-resize se-resize sw-resize 1.本地无缓存,每次自动刷新 response.expires=0 response.addheader"pragma","no-cache" response.addheader"cache-control","private" 2.修改contenttype并下载gif等格式 <% functiondl(f,n) onerrorresumenext sets=createobject("adodb.stream") s.mode=3 s.type=1 s.open s.loadfromfile(server.mappath(f)) iferr.number>0then response.writeerr.number&":"&err.description else response.contenttype="application/x-gzip" response.addheader"content-disposition:","attachment;filename="&n response.binarywrite(s.read(s.size)) endif endfunction calldl("012922501.gif","t1.gif") %>
19.检查一段字符串是否全由数字组成 <scriptlanguage="javascript"><!-- functionchecknum(str){return!/\d/.test(str)} alert(checknum("1232142141")) alert(checknum("123214214a1")) file://--></script> 20.获得一个窗口的大小 document.body.clientwidth,document.body.clientheight document.body.offsetwidth,document.body.offsetheight 有时还需要知道window.screentop,window.screenleft 21.怎么判断是否含有汉字 if(escape(str).indexof("%u")!=-1)alert("含有汉字"); elsealert("全是字符"); 22.textarea自适应文字行数的多少 ie5.5+可以用overflow-y:visible <textarearows=1name=s1cols=27style="overflow-y:visible"> </textarea> 23.日期减去天数等于第二个日期 <scriptlanguage=javascript> functioncc(dd,dadd) { file://可以加上错误处理 vard=newdate(dd.replace("-","/")) d.setdate(d.getdate()+dadd) alert(d.getfullyear()+"年"+(d.getmonth()+1)+"月"+d.getdate()+"日") } cc("2002-2-28",2) </script>
|