Home > Web Front-end > JS Tutorial > js obtains the Value/Text and selected value information of RadioButtonList and other information implementation code_javascript skills

js obtains the Value/Text and selected value information of RadioButtonList and other information implementation code_javascript skills

WBOY
Release: 2016-05-16 17:41:04
Original
1443 people have browsed it

HTML code

Copy code The code is as follows:

RepeatColumns="4" RepeatDirection="horizontal">
asp: ListItem>
asp:ListItem>
asp:ListItem>
asp:ListItem>


JS code:
Copy code The code is as follows:

function RadioButtonList1Changed()
{
var rbtn = document.getElementByIdx_x("rbtnCompany");
//Get all radios
var list= rbtn .getElementsByTagName_r("input");
for (var i = 0; i < list.length; i ) {
if (vRbtidList[i].checked) {
var text = rbtn .cells[i].innerText;
var value = list[i].value;
alert("checked The text value of the item is " text ", and the value value is " value);
}
}
}

can be specified to obtain a certain value. The following statements are combined of. Get the value of the first item with index 0
Copy code The code is as follows:

alert( document.getElementByIdx_x("rbtnCompany").getElementsByTagName_r("input")[0].value);//The result is 1
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template