JS 에서 노드 아래 요소 가 져 오기

2672 단어 JavaScripthtmlbbs
<html> 
<head> 
<title>fish</title> 
<script language="javascript"> 
function get(){ 
var xx=document.getElementById("bbs") 
alert("    :"+xx.tagName); 
} 
function getElementName(){ 
var ele = document.getElementsByName("happy"); 
alert("   happy   :" + ele.length); 
} 
</script></head> 
<body onselectstart="return false"> 
<h2 id="bbs">         </h2> 
<hr> 
<form> 
<input type="button" onclick="get()" value="      "> 
<input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "> 
</form> 
</body> 
</html><html> 
<head> 
<title>fish</title> 
<script language="javascript"> 
function get(){ 
var xx=document.getElementById("bbs") 
alert("    :"+xx.tagName); 
} 
function getElementName(){ 
var ele = document.getElementsByName("happy"); 
alert("   happy   :" + ele.length); 
} 
</script></head> 
<body onselectstart="return false"> 
<h2 id="bbs">         </h2> 
<hr> 
<form> 
<input type="button" onclick="get()" value="      "> 
<input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "><input type="button" name="happy" onclick="getElementName()" value="click "> 
</form> 
</body> 
</html>

좋은 웹페이지 즐겨찾기