<%@ page language="java" contentType="text/html; charset=utf-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<div id="div_001">
<form id="form_001">
<input type="button" id="button_001_id" name="button_001_Name" value="单击查看" class="button_001_Class" onclick="Get_srcElement(this)">
</form>
</div>
<script>
function Get_srcElement()
{
var srcElement=""
srcElement = srcElement + "\n" + "event.srcElement.id : " + event.srcElement.id
srcElement = srcElement + "\n" + "event.srcElement.tagName : " + event.srcElement.tagName
srcElement = srcElement + "\n" + "event.srcElement.type : " + event.srcElement.type
srcElement = srcElement + "\n" + "event.srcElement.value : " + event.srcElement.value
srcElement = srcElement + "\n" + "event.srcElement.name : " + event.srcElement.name
srcElement = srcElement + "\n" + "event.srcElement.className : " + event.srcElement.className
srcElement = srcElement + "\n" + "event.srcElement.parentElement.id : " + event.srcElement.parentElement.id
alert(srcElement)
}
</script>
</body>
</html>
运行结果是:
event.srcElement.id :button_001_id
event.srcElement.tagName :input
event.srcElement.type :button
event.srcElement.value :单击查看
event.srcElement.name :button_001_Name
event.srcElement.className :button_001_Class
event.srcElement.parentElement.id :form_001
event.srcElement.getattribute :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<div id="div_001">
<form id="form_001">
<input type="button" id="button_001_id" name="button_001_Name" value="单击查看" class="button_001_Class" onclick="Get_srcElement(this)">
</form>
</div>
<script>
function Get_srcElement()
{
var srcElement=""
srcElement = srcElement + "\n" + "event.srcElement.id : " + event.srcElement.id
srcElement = srcElement + "\n" + "event.srcElement.tagName : " + event.srcElement.tagName
srcElement = srcElement + "\n" + "event.srcElement.type : " + event.srcElement.type
srcElement = srcElement + "\n" + "event.srcElement.value : " + event.srcElement.value
srcElement = srcElement + "\n" + "event.srcElement.name : " + event.srcElement.name
srcElement = srcElement + "\n" + "event.srcElement.className : " + event.srcElement.className
srcElement = srcElement + "\n" + "event.srcElement.parentElement.id : " + event.srcElement.parentElement.id
alert(srcElement)
}
</script>
</body>
</html>
运行结果是:
event.srcElement.id :button_001_id
event.srcElement.tagName :input
event.srcElement.type :button
event.srcElement.value :单击查看
event.srcElement.name :button_001_Name
event.srcElement.className :button_001_Class
event.srcElement.parentElement.id :form_001
event.srcElement.getattribute :