首页 >web前端 >js教程 >IE event.srcElement和FF event.target 功能比较_javascript技巧

IE event.srcElement和FF event.target 功能比较_javascript技巧

WBOY
WBOY原创
2016-05-16 18:33:331223浏览

注意获取的标记都以大写表示,如"TD","TR","A"等

复制代码 代码如下:







<script> <BR>function Get_srcElement(evgl) <BR>{ <BR>  var srcElement="" <BR>   //判断是IE 还是Firefox <BR>  var evg=evgl.srcElement?evgl.srcElement:evgl.target; <BR>  srcElement = srcElement + "\n" + "button_001_id----event.srcElement.id : " + evg.id <BR>  srcElement = srcElement + "\n" + "input---event.srcElement.tagName : " + evg.tagName <BR>  srcElement = srcElement + "\n" + "button---event.srcElement.type : " + evg.type <BR>  srcElement = srcElement + "\n" + "单击查看---event.srcElement.value : " + evg.value <BR>  srcElement = srcElement + "\n" + "button_001_Name---event.srcElement.name : " + evg.name <BR>  srcElement = srcElement + "\n" + "button_001_Class---event.srcElement.className : " + evg.className <BR>  //IE 支持parentElement FireFox支持parentNode <BR>  srcElement = srcElement + "\n" + "form_001---event.srcElement.parentElement.id : " +     evg.parentNode.id <BR>  srcElement = srcElement + "\n" + "event.srcElement.getattribute : " + evg.getAttribute <BR>  alert(srcElement); <BR>} <BR></script>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn