`
hbuxzy
  • 浏览: 23564 次
文章分类
社区版块
存档分类
最新评论

js 函数整理

 
阅读更多

类型转换:parseInt\parseFloat\toString

类型判断:typeof;eg:if(typeof(var)!="undefined")\isNaN

字符处理函数:toLowerCase\touppercase\
substring(从哪里截到哪)\substr(从哪里开始;截多少个字符) \indexOf(字串中找某串字符)\replace(替换函数)\
charCodeAt
concat
split
join

定时处理函数:setInterval;setTimeout;clearTimeout;clearInterval

两个显示控制属性:visibility(hidden,hide,show,visible);display(none,block,inline)

编码的一些函数:escape();

取得对象的方法:
document.getElementsByTagName(根据标签名获得对象组)\
document.getElementsByTagName('head').item(0)
document.getElementsByName(通过NAME获得对象)\
document.getElementById(通过ID获得对象)\
document.form1.f1\
document.all.tags(t)[id]
document.all[id]
document.layers[id]

不常用的一些方法:
moveToAbsolute:
fromElement
toElement
contains
captureEvents
parent.frames
moveTo(x,y)
resizeBy(x,y)
resizeTo(x,y)
attachEvent('onmousedown',showHide);
document.createElement('')
document.createTextNode('')
obj.setAttribute('src','')
obj.getAttribute('')
event.srcElement
style.cssText
document.body.appendChild
document.body.removeChild
document.body.insertAdjacentHTML("AfterBegin",s)
innerHTML/
removeNode
insertBefore
arguments
event.keyCode

正则相关:RegExp(eg:new RegExp("\"","g"))

一些长宽及位置属性:
window.innerHeight
window.innerWidth
document.documentElement.clientWidth
document.documentElement.clientHeight
document.body.clientWidth
document.body.clientHeight
document.body.offsetWidth
document.body.offsetHeight
document.body.scrollLeft
document.body.scrollTop
document.location.reload()

window一些方法:
window.onerror=function(){return true;}隐去报错
window.onload\window.onunload
window.status
window.parent.location.href
window.location.href
window.top.location.href

数学方法:
Math.max

数组方法:
length
slice

JS输出方法:
document.write(s);
alert(s);
confirm
prompt
document.writeln
弹窗方法:
window.showModalDialog(<url>,<标题>,<属性>)
window.open("","","");


附:常用DOM方法和属性(即必须掌握部分)

创建节点:createElement();createTextNode()
复制节点:cloneNode()
插入节点:appendChild();insertBefore()
删除节点:removeChild()
替换节点:replaceChild()
设置节点属性:setAttribute()
查找节点:getAttribute();getElementById();getElementsByTagName();hasChildNodes
节点的属性:nodeName;nodeType;nodeValue
遍历节点树:childNodes;firstChild;lastChild;nextSibling;parentNode;previousSibling


分享到:
评论

相关推荐

    JavaScript函数整理

    常用JavaScript函数整理。 正则表达式验证。

    学习DWR JavaScript函数整理

    ** 描 述:公用函数 ** 版 本:V1.0 ******************************************************************/ //全局变量 g_sourceSubstr = "`~" //要替换的字串 g_objecSubstr = "\"" //替换为的字串 /***********...

    javascript 开发之百度地图使用到的js函数整理

    javascript 开发之百度地图使用到的js函数整理 接项目用到的地图,客户要求用百度地图,没办法只好用百度地图,这里总结一下,写的一些函数,注释比较详细! //创建和初始化地图函数: function initMap(){ ...

    一些高频JS函数(整理)

    自己整理的高频JS函数,希望对大家有用,不错的话大家都下着玩吧

    整理的JavaScript函数

    整理的10大JavaScript函数,prototype的$函数,隐藏、显示元素函数,通过className获取DOM元素函数

    各种常用的JS函数整理

    JS函数经常使用的比较多比如获取页面地址参数、地址跳转、判断是否数字等等,在本文整理了一些,感兴趣的可以参考下

    js 通用javascript函数库整理

    js 通用javascript函数库整理,学习js的朋友可以参考下。

    自己整理的一个JS函数库 AJAX dom隐藏显示 数据整理 只有12KB 压缩后5kb

    自己整理的一个JS函数库 AJAX dom隐藏显示 数据整理 只有12KB 压缩后5kb 使用方法 引入文件 然后就可以直接使用了 具体函数方法如下 /* $(id) 根据元素id返回对象 N(name, i) 根据元素name返回对象,可能会有多个...

    javascript常用函数归纳整理

    本文整理归纳了一些js常用函数,其中包括对数据操作,字符替换操作,日期及加解密操作函数,还有一些简单的验证函数。便于大家查阅参考。相信对大家会有所帮助。 1.typeof、constructor、instanceof对数组的判断 ...

    javascript 验证函数集合

    javascript 验证函数集合: 收集整理了一些javascript常用的验证函数,需要的朋友可以下载。

    JavaScript基础函数整理汇总

    主要介绍了JavaScript基础函数整理汇总,需要的朋友可以参考下

    一些常用的Javascript函数

    把自己写的一些通用JS函数整理了下:) /*判断浏览器版本*/ var w3c=(document.getElementById)? true: false; var agt=navigator.userAgent.toLowerCase(); var ie = ((agt.indexOf(“msie”) != -1) && ...

    整理Javascript函数学习笔记

    1、什么是函数 如果需要多次使用同一段代码,可以把它们封装成一个函数。函数(function)就是一组允许在你的代码里随时调用的语句。每个函数实际上是一个短小的脚本。 如:要完成多组数和的功能。 var sum; sum = ...

    javascript : 常用函数整理(持续中)

    NULL 博文链接:https://ado88.iteye.com/blog/264464

    最实用的JS数组函数整理

    软件开发网以前就给大家整理过关于JS数组相关的内容,这次我们给大家整理的是非常实用的JS数组操作技巧和写法,学习下吧。 instanceof 检测一个对象是否是数组;(用来对付复杂数据类型;) // 简单数据类型 typeof ; A...

    H5编辑器涉及的原生js函数.docx

    H5编辑器涉及的原生js函数,其中很多都是涉及到js的高阶函数,只是进行了收集与整理!希望有所帮助而已

Global site tag (gtag.js) - Google Analytics