复制代码代码如下:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<голова>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<Title> JS 函数中获取事件源 </title>
<script type = "text/javascript" ranguage = "javascript">
function Chang () {
var evt = событие || window.event;
предупреждение (evt.srcelement.id);
}
</script>
</head>
<div>
<input type = "text" onclick = "Chang ();" id = "input_a" />
<input type = "text" onclick = "Chang ();" id = "input_b" />
</div>
<тело>
</body>
</html>