JavaScript

String对象:

    x.length                获取字符串的长度

    x.toLowerCase()         转为小写

    x.toUpperCase()         转为大写

    x.trim()                去除字符串两边的空格

    x.chaeAt(index)         获取index位置的字符

    x.indexOf(findstr,index)查询字符串

    x.lastIndexOf(findstr) 

    x.match(regexp)         返回匹配字符串的数字,没有返回null

    x.search(regexp)        返回匹配字符串的首字符位置索引

    x.substr(start,length)  截取从start位置,length长度的字符

    x.substring(start,end)  截取从start位置到end位置的字符

    x.slice(start,end)      字符串的切片操作

    x.replace(findstr,rostr)字符串的替换

    x.split()               字符串的分割

    x.conncat(addstr)       字符串的拼接

   

Array对象:

    arr.join('-')           '1-2-3-4-5'

    arr.conncat(6,7)        1,2,3,4,5,6,7

    arr.toString()          1,2,3,4,5,6,7

    arr.reverse()           反转元素

    arr.sort()              排序

    arr.sort(intSort)       按数字比较

    arr.slice(2,-1)         数组的切片

    arr.splice(1,2)         删除索引为1开始的两个元素

    arr.push([1,2,3])       向末尾增加值,增加的值可以使字符串,数字,数组

    arr.pop()               删除最末尾的元素,并返回

    arr.unshift(4,5)        向数组首部添加至

    arr.shift()             删除首部的数组元素

Function对象:

    arguments

        arguments.length    返回参数个数

        for(var args in arguments) 当参数个数不确定的时候,循环遍历参数

    匿名函数:

        (func(){

        alert('ssss')})

DOM:

    创建一个节点:

        var tag=document.createElement('inpit').setAttribute('type','text')

    添加一个节点:

        parentNode.appendChild(tag);

        parentNode.insertBefore(tag,somenode);把增加的节点放到某个节点前

    删除节点:

        removeChild(tag)

    替换节点:

        parentNode.replaceChild(tag,somenode);替换某个节点

    获取节点文本值:

        innerText:纯文本值  innerHTML:获取里面的元素和文本值

    属性操作:

        setAttribute('name':'value')

        getAttribute('name')

        removeAttribute('name')

     改变CSS样式:

        document.getElementById('p2').style.color='blue';

     时间触发:

        script 标签可以放在head标签,在body中 添加onload='func()'

        onsubmit 在form表单是使用,在提交表单的之前执行js操作,return false,阻止表单提交

        event.stopPropagation(); //阻止事件向外层div传播

        onchange,在select标签中,适用

        onmouseout 不论鼠标指针离开被选元素还是任何子元素,都会触发事假

        onmouseleave 只有在鼠标指针离开被选元素时,才会触发mouseleave事件