year:2017 month:7 day:19

时间:2023-03-08 16:40:54
year:2017 month:7 day:19

2017-07-19

JavaScript

一:javascirpt的对象

1:数组对象

声明方式:(1)var arr=new Array();

     (2)var arr=new Array(12);

     (3)var arr[1,2,3,4]

2:字符串对象

一些有关的方法(1)indexof()获取字符下标

       (2)concat()要连接到字符串上的字符

       (3)split()通过输入的东西来分割字符串

       (4)substring()有两个参数,<包头不包尾>

3:Date对象

声明方式:var day=new Date();

一些有关的方法:(1)get year()+1990=get Fullyear()

        (2)get month()+1=真实的月份数

        (3)get day()=星期数

        (4)get date()=天数

        (5)to LocaleString()//获得当地时间

4:自定义对象

声明方式:(1)function person(有参){

       this.name=name;

       this.eat=function(){

       }     

      }

     (2)var person ={

      属性:值

      eat:function(){

       }

      }

     (3)var p=new person(){

      p.eat=function(){

       }

      }

二:BOM

(1)Window

最常用的几种:

document 对 Document 对象的只读引用

location 用于窗口或框架的 Location 对象

history 对 History 对象的只读引用

document.tilte 设置网页的标题

moveto() 将窗口左上角的屏幕位置移动到指定的 x 和 y 位置。

moveby() 相对于目前的位置移动。

resizeTo() 调整当前浏览器的窗口。

open() 打开新窗口显示指定的URL(有的浏览器中是打一个新的选项卡)

setTimeout(vCode, iMilliSeconds) 超时后执行代码。

setInterval(vCode, iMilliSeconds) 定时执行代码,第一次也是先待,到时再执行。

(2)screen

availHeight 获取系统屏幕的工作区域高度,排除 Microsoft Windows 任务栏。

availWidth 获取系统屏幕的工作区域宽度,排除 Windows 任务栏。

height 获取屏幕的垂直分辨率。

width 获取屏幕的水平分辨率

(3)Location

href属性 设置或获取整个 URL 为字符串。

reload() 重新装入当前页面

(4)history

history.go(-1);//返回上一个链接
history.go(1);//返回下一个链接

history.forward();

history.back();