开心

js内置对象

<script>

function people(name,age)

{

this._name=name;

this._age=age;

}

son=new people("zhu",10);

document.write("name:"+son._name+",age:"+son._age);

 

//2

hello=new Object();

hello.name="hell0";

hello.age=10;

document.write("name:"+hello.name+",age:"+hello.age);

 

//String 对象

 var str="a good people";

document.write("length:",str.length);

document.write(str.indexof("good"));//返回指定客串的索引,找不到返回-1;

document.write(str.match("good"));//不存在指定内容,返回     null

document.write(str.replace("good","well"));

document.write(str.toUpperCase());

var s=str.split(" ");

document.write(s[1]);

 

 

 

 

</script>

posted @ 2016-03-27 21:40  大喜  阅读(236)  评论(0编辑  收藏  举报
坦然 会增进信任 - 信任 感情才会升华