1. JavaScript中的对象
JavaScript是基于对象的,异于C++或Java的面向对象。
JavaScript的对象由属性和方法组成。
JavaScript对象:JavaScript内部对象,由浏览器环境提供,创建新对象
操作对象的语句:For ... in: For(对象属性名 in 已知对象名), with: with object{ ... }, this, New
对象属性的引用: (1) . (2). 下标 (3). 字符串作下标
对象方法的引用:ObjectName.methods();
常用对象:
string: length;
anchor(), big(), Italics(), bold(), blink(), small(), fixed(), fontsize(size), fontcolor(color),
toLowerCase(), toUpperCase(), indexOf[charactor,fromIndex], substring(start,end)
math: E, LN10, LN2, PI, SQRT1-2, SQRT2;
abs(), sin(), cos(), asin(), acos(), tan(), atan(), round(), sqrt(), Pow(base, exponent)
Date: MyDate = New Date();
getYear(), ...
setYear(), ...
创建新对象
Function Object(属性表)
This.prop1=prop1
This.prop2=prop2
...
This.meth=FunctionName1;
This.meth=FunctionName2;
...
用New对象的方法实现JavaScript中的数组
Function arrayName (size)
For (var X=0; X<=size;X++)
this[X]=0;
this.lenght=size;
Return this;
内部数组
anchors[]
links[]
Forms[]
Elements[]
Frames[]
anchors[]
使用浏览器内部对象:
navigator
windows
location
history
document (*)
document:
Links Anchor Form Method Prop 链接对象 锚对象 窗体对象 方法 对象
document的attribute属性:alinkcolor, linkcolor, VlinkColor,bgcolor, Fgcolor
document的基本元素:forms,anchors,links
2. JavaScript中的系统函数
test=eval("8+9+5/2"); //返回字符串表达式中的值
unEscape (string); //返回字符串ASCII码
escape(character) //返回字符编码
parseFloat(floustring); //返回实数
parseInt(numbestring ,radix); //返回不同进制的数
本文介绍了JavaScript中的对象和系统函数,详细讲解了对象的属性、方法及创建方式,同时提供了常用对象如String、Math、Date等的使用示例。此外还介绍了系统函数如eval、escape等的功能。

被折叠的 条评论
为什么被折叠?



