<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Insert title here</title><script type="text/javascript">
function fun(id){ var e = document.getElementById(id); var v = e.getAttribute("value"); alert(v); } </script> </head> <body><div onClick="fun(this.id)" id="id" style="border:green; width:100px;height=50px; clear:both;" value="click here">click here</div> </body> </html> 你发在这里不一样吗? 哈
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title><script type="text/javascript">
function fun(id){
var e = document.getElementById(id);
var v = e.getAttribute("value");
alert(v);
}
</script>
</head>
<body><div onClick="fun(this.id)" id="id" style="border:green; width:100px;height=50px; clear:both;" value="click here">click here</div>
</body>
</html>
你发在这里不一样吗? 哈