NextSibling Next Sibling node
PreviousSibling Last Brother
ParentNode Father Node
1<select><option value= "Zs" > Zhongshan </option><option value= "GZ" > Guangzhou </option><option Value= "zh" > Shenzhen </option><option value= "zh" > Zhuhai </option></select>2<script type= "Text/javascript" >3 //gets the number of child elements under the <select> element node4 //var selectelement = document.getElementsByTagName ("select") [0];5 //var size = selectElement.childNodes.length;6 //alert ("+size+" is a common element in "select");7 8 //get the "Zhongshan" string9 //var selectelement = document.getElementsByTagName ("select") [0];Ten //var zselement = selectelement.firstchild; One //var zs = zselement.innerhtml; A //alert (ZS); - - //get the "Guangzhou" string the //var selectelement = document.getElementsByTagName ("select") [0]; - //var zselement = selectelement.firstchild; - //var gzelement = zselement.nextsibling; - //var gz = gzelement.innerhtml; + //alert (GZ); - + //get the "Zhuhai" string A //var selectelement = document.getElementsByTagName ("select") [0]; at //var zhelement = selectelement.lastchild; - //var zh = zhelement.innerhtml; - //alert (zh); - - //get the "Shenzhen" string - //var selectelement = document.getElementsByTagName ("select") [0]; in //var zhelement = selectelement.lastchild; - //var szelement = zhelement.previoussibling; to //var sz = szelement.innerhtml; + //alert (SZ); - the //Delete "Guangzhou" element * varGzelement = document.getelementsbytagname ("option") [1]; $ varSelectElement =Gzelement.parentnode;Panax Notoginseng Selectelement.removechild (gzelement); - the + A the</script>