如何在javascript中传递复选框值 [英] How to pass the checkbox value in javascript

查看:67
本文介绍了如何在javascript中传递复选框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用for循环在jsp中检索DataBase中的一些行并以表格格式显示它。在输出表中我还添加了一个文本框和checkbok行。在文本框中,我必须手动输入一些值,当我检查其相应的复选框时,值应该传递到另一个jsp。

这是一个代码,通过它我将名称分配给文本框和复选框

展开 | 选择 | Wrap | 行号

解决方案

大家好,

我必须检查值使用javascript的10个复选框,有没有人知道怎么做?我正在使用代码:

展开 | 选择 | Wrap | 行号


欢迎使用字节。


要使用i值作为复选框的名称,请使用elements数组:

展开 | 选择 | Wrap | 行号


感谢您的回复!


问题仍然没有解决,它给了我一些错误

< b>''document.form1.elements [...]。checked''是nill或者不是对象

展开 | 选择 | Wrap | 行号

Hi all,
I am retrieving some rows from DataBase using for loop in jsp and displaying it in a table format.In the output table I am also adding one more text box and checkbok with each row. In text box i have to enter some value manually and when i check its corresponding checkbox the value should get passes into another jsp.
This is a code by which i am assigning the name to textboxes and checkboxes

Expand|Select|Wrap|Line Numbers

解决方案

Hi all,
I have to check the value of the 10 checkboxes using javascript, does anyone khow how to do this ?? i am using the code :

Expand|Select|Wrap|Line Numbers


Welcome to Bytes.

To take the i value to use for the name of the checkbox, use the elements array:

Expand|Select|Wrap|Line Numbers


Thanks for your reply !

The problem is still not solved, it is giving me some error

''document.form1.elements[...].checked'' is nill or not an object

Expand|Select|Wrap|Line Numbers


这篇关于如何在javascript中传递复选框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆