如何在javascript中动态创建复选框 [英] How to dynamically create checkboxes in javascript

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

问题描述



有一个数组的长度在用户输入上动态变化,我必须提供此数组的复选框以及数组的值并基于用户选择的复选框该复选框的值必须在php代码中重新获取以进行进一步处理。

注意:数组x的值动态变化,这里它是3,它甚至可以多于或少于那个。

Hi,
There is an array whose length varies dynamically on the users input, I have to provide checkboxes for this array along with the value of the array and based on the checkboxes selected by the user the value of that checkbox has to be retrived back at the php code for further processing.
NOTE:The value of the array x changes dynamically, here it is 3, it can even be more or less than that.

展开 | 选择 | Wrap | 行号

推荐答案

放一个引用va不是更容易lue到复选框并从PHP中读取所需的输入数据?
wouldn''t it be easier to put a reference value to the checkbox and read in PHP from that the required input data?
展开 | 选择 | Wrap | 行号


你是告诉javascript不是完全需要??然后如何接受用户输入检查复选框?
are you telling that the javascript is not required at all?? then how to accept the users input of checking a checkbox?


是。

如果选中复选框,其值将以表格数据提交(如果复选框有一个名称属性)


PS:我刚刚完成了这样一个脚本3天前
yup.
if a checkbox is checked, its value is submitted in the form data (if the checkboxes have a name attribute)

PS: I just finished such a script 3 days ago


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

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