没有问题。
<script>
window.onload = function() {
alert(document.getElementsByTagName("input")[0].name);
}
</script> <input type="text" name="abc" id="abc"/>没有任何的问题。
<script>
window.onload = function() {
alert(document.getElementsByTagName("input")[0].name);
}
</script> <input type="text" name="abc" id="abc"/>没有任何的问题。
function abc(){
var element = document.getElementsByTagName("input");
alert(element[0].getAttribute("name")); //output : abc
alert(element[0].getAttribute("type")); //output : text
}
</script>
<input type="text" name="abc" id="abc" value="123">
<input type="button" onclick="abc()" value="click">