//构造函数
function Box(name,age){
this.name=name;
this.age=age;
this.run=function(){
return this.name+'--'+this.age;
}
}
var box1= Box('gao',23);//我是一个对象
var box2=new Object();
Box.call(box2,'chen','24'); 对象冒充
console.log(box2 instanceof Object);//冒充后我依然从属于Object对象
console.log(box2 instanceof Box);//冒充后我并不从属于与Box <!DOCTYPE html> <html> <head> <title>捕捉和冒泡</title> <meta charset="utf-8"> </head> <bo...
代码1:<!--代码开始--> <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script> <script>...
rem原理和简介(1).字体单位单位的值是根据html根元素大小而定,同样可以作为宽度高度单位(2).适配原理将px替换为rem,动态修改html的font-size适配(3).单位1rem=16px,why? F12中1rem在computed中font-size属性中会显示为font-size:...
js生成二维码(1).下载二维码类库https://github.com/davidshimjs/qrcodejs(2).引入类库<script type="text/javascript" src="//static.runoob.com/a...
JavaScript类型判断的四种方法:1.typeof、2.instance of、3.Object.prototype.toString.call()、4.constructorJavaScript数据类型JavaScript有八种内置类型,除对象外,其他统称为“基本类型”。 空值(null)...
js选择文件进行上传转换为base64的方法: let reader = new FileReader(); reader.readAsDataURL(file[0]) console.lo...