求一个js获取文本框值的写法--急,在线等,提供帮助即给分 本帖最后由 vgy12304 于 2010-01-08 09:47:12 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 哈,接点分。N年没混论坛了现在缺分哈~//提取出所有input标签内容//Tips: document.getEle.... 你可以修改为你指定容器,例如 document.getElementById('getInputArea')//getInputArea -> <div id="getInputArea">...这里有你想要提取的input</input>var inputs = document.getElementByTagName("input");var getValue = "";for(int i=0;i<inputs.length;i++){ if(inputs[i].type=="checkbox" && inputs[i].checked) { getValue = inputs[i].value+","; }}document.getElementById('actionid').value = getValue.replace(",$",""); document.getElementById('actionid').value这个不行,获取不到,提示undefinded 你就没定义ID当然没了。定义ID var actionid; ??? 不对啊,老兄我换思路了,把下面的部分也用<form name=upfrom>..</form>套起来,复制上面表单<form name='search_form'>的所有数据,下面表单<form name=upfrom>,再做一次提交 <head><title>test</title><script type="text/javascript">function clickSet() { var form = document.forms[0]; var actiontype = form.actiontype.value; alert(actiontype); return false; } </script><form></head><body><input type=checkbox name="nid[]" value=4> <input type=checkbox name="nid[]" value=5> <input type=checkbox name="nid[]" value=6> <input type=checkbox id=chkall onclick='checkall()'>全选 </td> <input type="radio" name="actiontype" value="multdel">删除 <input type='button' class='btn2' name=submit value=提交 onclick='clickSet();'></form></body></html> php怎么把1显示成01的格式 如何获取登录后跳转的网址,有点难度!! 无法发送邮件,提示连接被拒 关于用php做web service的服务器端? 问题 两个嵌套表单要分别提交,请问如何实现? 在PHP中连接Mysql 数据库有哪些方法? 图片作为提交按钮时,如何实现当被点击时打开一个弹出窗口(PHP)?要传表单的值. 一个有关limit的问题: 既然分目录存储比不分目录存储还要慢为什么还要分目录? 图片提交表单只刷新,没有提交,在线等 自己建站后网站群发邮件的问题
//提取出所有input标签内容//Tips: document.getEle.... 你可以修改为你指定容器,例如 document.getElementById('getInputArea')
//getInputArea -> <div id="getInputArea">...这里有你想要提取的input</input>
var inputs = document.getElementByTagName("input");
var getValue = "";
for(int i=0;i<inputs.length;i++)
{
if(inputs[i].type=="checkbox" && inputs[i].checked)
{
getValue = inputs[i].value+",";
}
}
document.getElementById('actionid').value = getValue.replace(",$","");
<head>
<title>test</title>
<script type="text/javascript">
function clickSet() {
var form = document.forms[0];
var actiontype = form.actiontype.value;
alert(actiontype);
return false;
} </script>
<form>
</head>
<body><input type=checkbox name="nid[]" value=4>
<input type=checkbox name="nid[]" value=5>
<input type=checkbox name="nid[]" value=6> <input type=checkbox id=chkall onclick='checkall()'>全选 </td>
<input type="radio" name="actiontype" value="multdel">删除
<input type='button' class='btn2' name=submit value=提交 onclick='clickSet();'>
</form>
</body>
</html>