类型转换:
parseInt(整数)\parseFloat(浮点)\toString (转化字符)。。还有 转化数字一些其中具体的细节不写了!
类型判断:
1.typeof;
console.log(bool instanceof Boolean);// false
console.log(num instanceof Number);// false
console.log(str instanceof String);// false
console.log(und instanceof Object);// false
console.log(nul instanceof Object);// false
console.log(arr instanceof Array);// true
console.log(obj instanceof Object);// true
console.log(fun instanceof Function);// true
console.log(s1 instanceof Symbol);// false
字符处理函数:
toLowerCase\touppercase\(大小写)
substring(从哪里截到哪)
substr(从哪里开始;截多少个字符)
indexOf(字串中找某串字符)
replace(替换函数)
charCodeAt 返回Unicode编码
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.οnerrοr=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