1. 程式人生 > >year:2017 month:7 day:19

year:2017 month:7 day:19

方式 cat split() 分割字符串 字符串 string ear tint nth

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.write,alert(),setInterval()

(2)screen

moveby 移動到指定位置
moveto 把窗口移動到固定位置
resizeto 增加或減小窗口
resizeby 將窗口調整成多大

(3)Location

(4)history

history.go(-1);//返回上一個鏈接
history.go(1);//返回下一個鏈接

history.forward();

history.back();

year:2017 month:7 day:19