JavaScript实现字符串的contains函数
摘要:/ * * string:原始字符串 * substr:子字符串 * isIgnoreCase:忽略大小写* /function contains(string, substr, isIgnoreCase) { if (isIgnoreCase) { string = string.toLowerCase(); substr = substr.toLowerCase(); } var startChar = substr.substring(0, 1); var strLen = substr.length; for (var j = 0; j<string.length - strLe
阅读全文
posted @
2011-07-20 13:07
sailxc
阅读(4437)
推荐(0)
JS实用技巧总结
摘要:1. 使用document.getElementById(id)代替document.all(id) 原因:FireFox不支持将ID作为document的下属对象变量名直接使用2. 使用document.getElementById(id)代替eval(id) 原因:FireFox不支持eval(id)的方法获取HTML对象3. 为所有控件设置ID属性 原因:当控件只有name而没有id时, 在FireFox下用document.getElementById返回null4. 使用[]获取集合类对象,如document.form.elements["name"] 原因:Fi
阅读全文
posted @
2011-07-14 17:16
sailxc
阅读(245)
推荐(0)