<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="jq.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript">
var tors = function(a1,a2){
this.name = '娃娃'
this.age = '1岁'
this.init(a1,a2);
};
tors.prototype = {
init: function(a1,a2){
console.log('我init')
this.render();
this.fangfa(a1,a2);
},
render: function(){
$("body").append('<div id="buttonLink">按钮</div></br><div id="buttonLink1">按||钮</div>')
},
fangfa: function(a1,a2){
$("#buttonLink").on('click',function(){
// console.log('我被点击了');
// console.log(name);
console.log(a1);
})
$("#buttonLink1").on('click',function(){
// console.log('我被点击了');
// console.log(name);
// this.name = '泡泡糖'
console.log(a2);
console.log(name);
bbq.name = '狗狗'
})
}
}
var bbq = new tors('我a1','她a2');
// console.log(bbq)
console.log(bbq.name);
console.log(tors.name);
</script>
</body>
</html>
网友评论