Javascript常用函数收集(不定期更新)

str.replace('/正则表达式/','替换内容');     //正则替换
str.match('/正则表达式/','替换内容'); //正则匹配
str.indexOf('查找代码');             //查找是否包含某字符串 str.charAt('第n个字符');             //取出字符串第n个字符
str.split('分割标志');             //字符串分割,返回数组
str.substr('第n个字符','长度'); //取出字符串第n个字符
str.toUpperCase();                      //转换大写
str.toLowerCase();                      //转换小写
isNaN(变量);                    //是否为数字值
parseInt('强转整型');               //强制转换变量类型为整型
parseInt('强转浮点型');              //强制转换变量类型为浮点型
external.AddFavorite("地址","收藏夹名称");   //添加到收藏夹
window.location.reload(); //刷新当前页面
parent.location.reload();                   //刷新父窗口
window.history.back();                     //返回前一页
window.location.reload();                   //刷新当前页面

 

posted @ 2015-07-30 11:50  boystar  阅读(183)  评论(0编辑  收藏  举报