• 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
  • 相关阅读:
    upc组队赛3 T-net【贪心】
    upc组队赛5 Assembly Required【思维】
    upc组队赛5 Bulbs
    upc组队赛5 Ingenious Lottery Tickets【排序】
    upc组队赛5 Hunter’s Apprentice 【判断多边形边界曲线顺逆时针】
    upc组队赛5 Ground Defense【枚举】
    upc组队赛4 Go Latin
    upc组队赛4 TV Show Game 【2-SAT】
    POJ 3250 Bad Hair Day【单调栈入门】
    016.NET5_MVC_视图组件扩展定制
  • 原文地址:https://www.cnblogs.com/Look_Sun/p/1787674.html
Copyright © 2020-2023  润新知