偶看新闻是一部内容开放、自由的互动网络百科全书客观、专业、权威的知识性百科全书
来源:百度文库 编辑:偶看新闻 时间:2024/05/01 11:10:37
HTML文件标记
文字排版标记
文字排版标记 原始文字样式 向内缩排 标题, 粗体,, 斜体 底线 删除线 文字闪烁 大型字体 小型字体 文字上标 文字下标 默认字体设置 更改字体设置
原始文字样式 向内缩排 标题, 粗体,, 斜体 底线 删除线 文字闪烁 大型字体 小型字体 文字上标 文字下标 默认字体设置 更改字体设置
向内缩排 标题, 粗体,, 斜体 底线 删除线 文字闪烁 大型字体 小型字体 文字上标 文字下标 默认字体设置 更改字体设置
菜单标记
直线与表格标记
超链接标记 锚
图形标记 插入图形
框架标记 定义框架内容 不支持框架声明
表单标记
SCRIPT
VBSCRIPT标记索引
基本运算+ 数字加法及字符串连接- 数字减法* 数字乘法/ 数字除法Mod 求余数\ 求商数& 字符串连接^ 次方= 相等<> 不相等>= 大于或等于> 大于<= 小于或等于< 小于Not 非And 且Or 或Xor 异或
循环及决策if ....then 若...则...if ...then...else 若...则...非else if... 非若select case... 群组选择条件end selectfor ... 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函数贴出来,
strsql="select * from p_type where slanguage=1 and typelevel=1 order by typename"set rs=fgetrslist(strsql)do while not rs.eof
%>
looprs.closeset rs=nothing%>
计算网页文本的汉字字数,去掉了表格以外的所有标识。Function GetLength(strChinese1)Dim strWord, ascWord, lenTotalstrChinese1 = Trim(strChinese1)
If strChinese1 = "" Or Vartype(strChinese1) = vbNull ThenGetLength = 0Exit FunctionEnd If
lenTotal = 0 For GetLengthi=1 to Len(strChinese1)strWord = Mid(strChinese1, GetLengthi, 1)ascWord = Asc(strWord)If ascWord < 0 or ascWord > 127 thenlenTotal = lenTotal + 1Elseif ascWord = 63 And strWord <> "?" thenlenTotal = lenTotal + 1Elseif ascWord = 44 And strWord <> "," thenlenTotal = lenTotal + 1Elseif ascWord = 33 And strWord <> "!" thenlenTotal = lenTotal + 1ElselenTotal = lenTotalEnd IfNext
GetLength = lenTotalEnd 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) 无效使用 NullMicrosoftVBscript运行时错误(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 或 GetMicrosoftVBscript运行时错误(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 无效使用 Nullerror # 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 或 Geterror # 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获得图象的实际尺寸的示例
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 ThenisJPG = trueElseisJPG = falseEnd IfEnd Function
Function isPNG(fichero)If inStr(uCase(fichero), ".PNG") <> 0 ThenisPNG = trueElseisPNG = falseEnd IfEnd Function
Function isGIF(fichero)If inStr(uCase(fichero), ".GIF") <> 0 ThenisGIF = trueElseisGIF = falseEnd IfEnd Function
Function isBMP(fichero)If inStr(uCase(fichero), ".BMP") <> 0 ThenisBMP = trueElseisBMP = falseEnd IfEnd Function
Function isWMF(fichero)If inStr(uCase(fichero), ".WMF") <> 0 ThenisWMF = trueElseisWMF = falseEnd IfEnd Function
Function isWebImg(f)If isGIF(f) Or isJPG(f) Or isPNG(f) Or isBMP(f) Or isWMF(f) ThenisWebImg = trueElseisWebImg = trueEnd IfEnd Function
Function ReadImg(fichero)If isGIF(fichero) ThenReadImg = ReadGIF(fichero)ElseIf isJPG(fichero) ThenReadImg = ReadJPG(fichero)ElseIf isPNG(fichero) ThenReadImg = ReadPNG(fichero)ElseIf isBMP(fichero) ThenReadImg = ReadPNG(fichero)ElseIf isWMF(fichero) ThenReadImg = ReadWMF(fichero)ElseReadImg = Array(0,0)End IfEnd IfEnd IfEnd IfEnd IfEnd Function
Function ReadJPG(fichero)Dim fso, ts, s, HW, nbytesHW = 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.CloseReadJPG = HWEnd Function
Function ReadPNG(fichero)Dim fso, ts, s, HW, nbytesHW = 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.CloseReadPNG = HWEnd Function
Function ReadGIF(fichero)Dim fso, ts, s, HW, nbytesHW = 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.CloseReadGIF = HWEnd Function
Function ReadWMF(fichero)Dim fso, ts, s, HW, nbytesHW = 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.CloseReadWMF = HWEnd Function
Function ReadBMP(fichero)Dim fso, ts, s, HW, nbytesHW = 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.CloseReadBMP = HWEnd Function
Function isDigit(c)If inStr("0123456789", c) <> 0 ThenisDigit = trueElseisDigit = falseEnd IfEnd Function
Function isHex(c)If inStr("0123456789ABCDEFabcdef", c) <> 0 ThenisHex = trueElseishex = falseEnd IfEnd Function
Function HexToDec(cadhex)Dim n, i, ch, decimaldecimal = 0n = Len(cadhex)For i=1 To nch = Mid(cadhex, i, 1)If isHex(ch) Thendecimal = decimal * 16If isDigit(c) Thendecimal = decimal + chElsedecimal = decimal + Asc(uCase(ch)) - Asc("A")End IfElseHexToDec = -1End IfNextHexToDec = decimalEnd Function%>
常用的javascript functionfile://=========================================// 输入数据检验// 检验空值function funCheckEmpty(m_Text) {var strTmp=m_Textif (strTmp == null || strTmp == "") {return false}return true}
file://检验内容的长度function funTextLenCheck(m_Text) {var strText=m_Textfor(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_Textif (isNaN(strTmp)) {return false} return true}
file://检验日期是否合法function funcheckDate(m_Year,m_Month,m_Day){file://根据月先取得最大日期var maxDayif (m_Month==2) {maxDay=28if (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=textstrTmp=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=textif (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=textif (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"将彻底屏蔽鼠标右键no
19.检查一段字符串是否全由数字组成20.获得一个窗口的大小document.body.clientwidth,document.body.clientheight
21.怎么判断是否是字符if(/[^\x00-\xff]/g.test(s))alert("含有汉字");elsealert("全是字符");22.textarea自适应文字行数的多少23.日期减去天数等于第二个日期functioncc(dd,dadd){file://可以加上错误处理vara=newdate(dd)a=a.valueof()a=a-dadd*24*60*60*1000a=newdate(a)alert(a.getfullyear()+"年"+(a.getmonth()+1)+"月"+a.getdate()+"日")}cc("12/23/2002",2)24.选择了哪一个radiofunctioncheckme()foreachobinradio1ifob.checkedthenwindow.alertob.valuenextendfunctionstylebarcode25.获得本页url的request.servervariables("")集合response.write"variablesvalue"foreachobinrequest.servervariablesresponse.write""&ob&""&request.servervariables(ob)&""nextresponse.write""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键可以让光标移到下一个输入框28.检测某个网站的链接速度:把如下代码加入区域中:tim=1setinterval("tim++",100)b=1varautourl=newarray()autourl[1]="< src="pic/url.gif" align=absmiddle border=0> www.njcatv.net"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("")for(vari=1;idocument.write("=》=》")document.write("")}butt()functionauto(url){document.forms[0]["url"+b].value=urlif(tim>200){document.forms[0]["txt"+b].value="链接超时"}else{document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}b++}functionrun(){for(vari=1;i ")}/">http://";;;;;+autourl+")>")}run()
29.各种样式的光标auto:标准光标default:标准箭头hand:手形光标wait:等待光标text:i形光标vertical-text:水平i形光标no-drop:不可拖动光标not-allowed:无效光标help:?帮助光标all-scroll:三角方向标move:移动标crosshair:十字标e-resizen-resizenw-resizew-resizes-resizese-resizesw-resize1.本地无缓存,每次自动刷新response.expires=0response.addheader"pragma","no-cache"response.addheader"cache-control","private"2.修改contenttype并下载gif等格式<%functiondl(f,n)onerrorresumenextsets=createobject("adodb.stream")s.mode=3s.type=1s.opens.loadfromfile(server.mappath(f))iferr.number>0thenresponse.writeerr.number&":"&err.descriptionelseresponse.contenttype="application/x-gzip"response.addheader"content-disposition:","attachment;filename="&nresponse.binarywrite(s.read(s.size))endifendfunctioncalldl("012922501.gif","t1.gif")%>
19.检查一段字符串是否全由数字组成20.获得一个窗口的大小document.body.clientwidth,document.body.clientheightdocument.body.offsetwidth,document.body.offsetheight有时还需要知道window.screentop,window.screenleft21.怎么判断是否含有汉字if(escape(str).indexof("%u")!=-1)alert("含有汉字");elsealert("全是字符");22.textarea自适应文字行数的多少ie5.5+可以用overflow-y:visible23.日期减去天数等于第二个日期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)