实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
5
</script>
6
<script>
7
$(document).ready(function(){
8
9
test=function()
10
{
11
this.txt="This is an object property";
12
$("div").click($.proxy(this.myClick,this));
13
};
14
15
test.prototype.myClick = function(event)
16
{
17
alert(this.txt);
18
alert(event.currentTarget.nodeName);
19
};
20
21
var x = new test();
22
23
});
24
</script>
25
</head>
26
<body>
27
28
<div>This is a div element.</div>
29
30
</body>
31
</html>