赞
踩
<body> <form action="" method="get"> 姓名:<input type="text" id="name" value="小强"><br> </form> <div id="other"> <a href="">hello啊</a> </div> </body> <script type="text/javascript"> var info1 = document.getElementById("name").innerText; //<empty string> var info2 = document.getElementById("name").innerHTML; //<empty string> var info3 = document.getElementById("name").value; //小强 var info4 = document.getElementById("other").innerText; //hello啊 var info5 = document.getElementById("other").innerHTML; //<a href="">hello啊</a> var info6 = document.getElementById("other").value; //undefined console.log(info6); </script>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。