Skip to content

Commit c9e6c9b

Browse files
committed
Create bind_demo
bind的方法使用
1 parent b8023ed commit c9e6c9b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

question/bind_demo

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="Generator" content="EditPlus®">
6+
<meta name="Author" content="">
7+
<meta name="Keywords" content="">
8+
<meta name="Description" content="">
9+
<title>Document</title>
10+
</head>
11+
<body>
12+
<input type="button" id="button" />
13+
14+
<input type="text" id="text" value="bind的使用"/>
15+
<script type="text/javascript">
16+
<!--
17+
var button = document.getElementById("button"),
18+
text = document.getElementById("text");
19+
button.onclick = function() {
20+
alert("id:"+this.id+" \nvalue:"+this.value); // 弹出text
21+
}.bind(text);
22+
//-->
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)