<div class="codetitle"> <span><a style="CURSOR: pointer" data="69634" class="copybut" id="copybut69634" onclick="doCopy('code69634')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code69634"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><title>js函数中获取事件源</title> <br><script type="text/javascript" 언어="javascript"> <br>function chang() { <br>var evt = 이벤트 || 창.이벤트; <br>경고(evt.srcElement.id); <br>} <br><br></script> <br></head> <br><div> <br><input type="text" onclick="chang();" id="input_a" /> <br><input type="text" onclick="chang();" id="input_b" /> <br></div> <br><본문> <br></body> <br></html> <br> </div>