javascript的hasChildNodes()的应用
2012-12-22 23:27
405 查看
<html>
<head>
<title>getElementByName</title>
</head>
<body>
<form name="from1" action="text.html" method="post">
<input type="text" name="username" value="Id1" id="tid1" onchange="change()"/><br/>
<input type="text" name="username" value="Id2" id="tid2"/><br/>
<input type="text" name="username" value="Id3" id="tid3"/><br/>
<input type="button" name="ok" value="baocun"/>
</form>
<select name="edu" id="edu">
<option value="博士">博士...</option>
<option value="硕士">硕士...</option>
<option value="本科" selected="selected">本科...</option>
<option value="幼儿园">幼儿园...</option>
</select>
</body>
<script language="JavaScript">
//查看id="edu"的节点是否含有子节点
alert(document.getElementById("edu").hasChildNodes());
//查看id="id1"的节点是否含有子节点
alert(document.getElementById("tid1").hasChildNodes());
//hasChildNodes() 只能获取ID才能进行判断
</script>
</html
相关文章推荐
- javascript中parentNode,childNodes,children的应用详解
- javascript中parentNode,childNodes,children的应用详解
- javascript中parentNode,childNodes,children的应用详解
- javascript 中 parentNode,childNodes、children 应用
- javascript 中 parentNode,childNodes、children 应用
- Dojo 的 Ajax 应用开发进阶教程:JavaScript 技巧与高级特性(一)
- Javascript中内建函数reduce的应用详解
- Immutable 在 JavaScript 中的应用
- 用NativeScript创建JavaScript原生移动应用
- 大型应用的javascript架构
- JavaScript关于window.open()应用
- ArcGIS.Server.9.3和ArcGIS API for JavaScript实现查询定位中心的功能和FindTask功能应用(七)
- JavaScript按位运算符的应用简析
- Javascript高级应用:文件操作篇
- javascript-删除----splice()方法angular应用
- JavaScript的clone函数的实现及应用条件
- javascript中的jQuery简单应用
- JavaScript事件冒泡简介及应用
- React Native 简介:用 JavaScript 搭建 iOS 应用 (1)
- javascript应用使用继承吗?