Js_面向对象和多媒体

来源:互联网 发布:新日铁住金软件 待遇 编辑:程序博客网 时间:2024/06/11 21:52

一、为系统类增加方法
1.Image类:
如:
Image.prototype.demo=function(){
    alert("666");
}

二、自定义类:
①、定义一个类,增加属性:
如:
function Person(name,password,age,addr){
    this.name=name;
    this.password=password;
    this.age=age;
    this.addr=addr;
}

②、增加方法:
如:
Person.prototype.shoeSelf=function(){
    var str="我叫"+this.name+",我的密码是:"+this.password;
    alert(str);
};

三、多媒体
1.多媒体资源的添加:
如:
<audio id="audio">
    <source src="1.mp3" type="audio/mpeg"/>
</audio>

2.多媒体对象的操作:
①、多媒体对象的方法
video是一个对象

//播放
video.play();

//暂停
video.pause();

②、多媒体对象的属性
//声音大小
video.volume+=0.1;

//播放速度
video.playbackRate+=0.1;



原创粉丝点击