返回到:Prototype – 元素对象
此方法在元素上注册一个事件处理程序并返回元素。
语法
element.observe(eventName, handler[, useCapture = false]);
返回值
一个 HTML 元素。
例子
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function RegisterFunction() {
$('test').observe('click', function(event) {
alert(Event.element(event).innerHTML);
});
}
</script>
</head>
<body onload = "RegisterFunction();">
<p id = "test">Click me to see the result.</p>
</body>
</html>返回到:Prototype – 元素对象
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/9062.html
支付宝
微信