Home >Web Front-end >JS Tutorial >Comparison of IE event.srcElement and FF event.target functions_javascript skills

Comparison of IE event.srcElement and FF event.target functions_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:33:331228browse

Note that the acquired tags are expressed in uppercase letters, such as "TD", "TR", "A", etc.

Copy code The code is as follows :







<script> <br>function Get_srcElement(evgl) <br>{ <br> var srcElement= "" <br> // Determine whether it is IE or 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" "Click to view---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 supports parentElement FireFox supports 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>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn