JavaScript常用对象

来源:互联网 发布:java iterator 实现类 编辑:程序博客网 时间:2024/05/20 02:54

一、Window对象:全局对象,所有对象的顶级对象

1.1 常用属性:document,frames,location,screen......

1.2 常用方法:alert(),close(),open()....

备注:由于window对象使用十分频繁,又是其他对象的父对象,所以在使用Window对象的属性和方法时,JS允许省略Window对象的名称。

即:window.alert("");等效于alert("")

例:window.open("abc.html","abc","width=333,height=343,top=90,left=23");打开网页abc.html,命名为abc。

二、String对象

2.1 常用属性:string.length

2.2 常用方法:indexOf(),substr(),substring(),replace(),split()

三、Date对象

dateObj=new Date();

dateObj=new Date(dateValue);

dateObj=new Date(year,month,date.....);

常用方法:getFullYear();getMonth();getDate();getDay();getHours();


0 0