单选按钮列表 [英] radiobutton list
问题描述
我有一个modalpopupextender,其中有一个手风琴扩展器...
这个手风琴扩展器有4个AccordionPanes,每个AccordionPane都有一个单选按钮列表...
我试图在所有这些单选按钮列表中获取一个值
使用此代码,我只能从一个广播列表中获取价值
function GelenMakamSec() { var elementRef = document.getElementById(''<%=RadioButtonList1.ClientID %>''); var inputElementArray = elementRef.getElementsByTagName(''input''); for (var i = 0; i < inputElementArray.length; i++) { if (inputElementArray[i].checked) { $get("<%= TextBox2.ClientID %>;").value = document.getElementById(inputElementArray[i].id).value; } }
我还有其他3个单选按钮列表
您能帮助我吗,如何从所有单选按钮列表中获取一个值?
get(<%= TextBox2.ClientID%> ;;").value = document.getElementById(inputElementArray [i] .id).value; } }我还有其他3个单选按钮列表
您能帮我吗,我如何从所有单选按钮列表中获取值?
很显然,您需要的就是您要查找的元素的id.
var elementRef = document.getElementById(''<%=RadioButtonList1.ClientID %>'');
您可以以类似的方式为每个RadioButtonList创建变量,并具有使用它们的通用JavaScript函数.
您还可以使用JQuery并一起消除所有这些.将其替换为更具可读性和可维护性的东西
请参见 ^ ]
hi
my question is that
I have a modalpopupextender and in it an accordion extender...
this accordion extender has 4 AccordionPanes and each AccordionPane has a radio button list...
I try to get a value in these all radiobuttonlists
I can get value from only one radiolist with this code
function GelenMakamSec() { var elementRef = document.getElementById(''<%=RadioButtonList1.ClientID %>''); var inputElementArray = elementRef.getElementsByTagName(''input''); for (var i = 0; i < inputElementArray.length; i++) { if (inputElementArray[i].checked) { $get("<%= TextBox2.ClientID %>;").value = document.getElementById(inputElementArray[i].id).value; } }
I have 3 other radiobuttonlists
can you help me please how can I get a value from all radiobuttonlists
get("<%= TextBox2.ClientID %>;").value = document.getElementById(inputElementArray[i].id).value; } }I have 3 other radiobuttonlists
can you help me please how can I get a value from all radiobuttonlists
Obviously you need the id of the elements you are looking for, just as you have.
var elementRef = document.getElementById(''<%=RadioButtonList1.ClientID %>'');
You can create variables for each of the RadioButtonLists in a similar fashion and have a common JavaScript function to use them.
You could also use JQuery and do away with this all together. Replacing it with something more readable and maintainable
See This[^]
这篇关于单选按钮列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!