返回到:Prototype – 元素对象
此方法注销处理程序并返回元素。
语法
element.stopObserving(eventName, handler);
返回值
返回一个 HTML 元素。
例子
HTML
x
27
27
1
<html>
2
<head>
3
<title>Prototype examples</title>
4
<script type = "text/javascript"src = "/javascript/prototype.js"></script>
5
6
<script>
7
function handler(event) {
8
alert(Event.element(event).innerHTML);
9
}
10
function RegisterFunction() {
11
$('test').observe('click', handler );
12
alert("Registering the handler");
13
}
14
function UnRegister() {
15
$('test').stopObserving('click', handler);
16
alert("Now unregistering the handler");
17
}
18
</script>
19
</head>
20
21
<body onload = "RegisterFunction();">
22
<p id = "test">Click me to see the result.</p>
23
<br />
24
<p>Click the button to unregister the handler.</p>
25
<input type = "button" value = "UnReg" onclick = "UnRegister();"/>
26
</body>
27
</html>
返回到:Prototype – 元素对象
阅读剩余 40%
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/8995.html