Javascript高手在哪呢!!! for(i = 0;i<document.getElementsTagName("INPUT").length;i++){ alert(ocument.getElementsTagName("INPUT")[i].value)} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 for(i = 0;i <document.getElementsByTagName("INPUT").length;i++){ alert(document.getElementsByTagName("INPUT")[i].value);} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /></head><script> var check = function() { len = document.getElementsByTagName("input").length; for(i=0;i<len-1;i++) { if(document.getElementsByTagName("input")[i].value == "") { alert("第" + (i+1) +"个文本框为空"); } } } window.onload = function() { if(document.all) { document.body.lastChild.previousSibling.attachEvent("onclick",check); } else { document.getElementsByTagName("body")[0].addEventListener("click",check); } }</script><body><input type="text" value="1"><input type="text" ><input type="text" ><input type="text" value="2" ><input type="text" ><input type="button" value="测试"></body></html> 改一下兼容FF的.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /></head><script> var check = function() { len = document.getElementsByTagName("input").length; for(i=0;i<len-1;i++) { if(document.getElementsByTagName("input")[i].value == "") { alert("第" + (i+1) +"个文本框为空"); } } } window.onload = function() { if(document.all)//IE { document.body.lastChild.previousSibling.attachEvent("onclick",check); } else//FF { document.body.lastChild.previousSibling.addEventListener("click",check,false); } }</script><body><input type="text" value="1"><input type="text" ><input type="text" ><input type="text" value="2" ><input type="text" ><input type="button" value="测试"></body></html> for(i = 0;i <document.getElementsByTagType("INPUT").length;i++){ alert(document.getElementsByTagName("INPUT")[i].value);} jQuery中toggle为什么点第一次没用第二次才有用 同一个页面第二个jQuery的function()为什么不起作用 js添加元素后如何换行 请问这个定时器怎么就执行一次呢? 通过层包含的INCLUDE文件传值的问题 急!!如下代码在火狐下为什么不显示? 出问题了、 如何根据select改变embed里的src音乐地址 菜鸟问题 关于读本机的文件内容问题 我刚刚做了两个网站,几经修改,终于与大家见面了!多多请教(散分) 求在线编辑器,支持UBB 的那种 FireFox里如何实现象IE模式对话框那样,当得到返回值时才往下执行?
for(i = 0;i <document.getElementsByTagName("INPUT").length;i++)
{
alert(document.getElementsByTagName("INPUT")[i].value);
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<script>
var check = function()
{
len = document.getElementsByTagName("input").length;
for(i=0;i<len-1;i++)
{
if(document.getElementsByTagName("input")[i].value == "")
{
alert("第" + (i+1) +"个文本框为空");
}
}
}
window.onload = function()
{
if(document.all)
{
document.body.lastChild.previousSibling.attachEvent("onclick",check);
}
else
{
document.getElementsByTagName("body")[0].addEventListener("click",check);
}
}
</script>
<body>
<input type="text" value="1"><input type="text" ><input type="text" ><input type="text" value="2" ><input type="text" ><input type="button" value="测试">
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<script>
var check = function()
{
len = document.getElementsByTagName("input").length;
for(i=0;i<len-1;i++)
{
if(document.getElementsByTagName("input")[i].value == "")
{
alert("第" + (i+1) +"个文本框为空");
}
}
}
window.onload = function()
{
if(document.all)//IE
{
document.body.lastChild.previousSibling.attachEvent("onclick",check);
}
else//FF
{
document.body.lastChild.previousSibling.addEventListener("click",check,false);
}
}
</script>
<body>
<input type="text" value="1"><input type="text" ><input type="text" ><input type="text" value="2" ><input type="text" ><input type="button" value="测试">
</body>
</html>
{
alert(document.getElementsByTagName("INPUT")[i].value);
}