JS in how to get the value of radio

Category: Web Develop
 
yuhai1227
2009-02-21 11:56:44

Sponsored Links
<input type='radio' disdabled id='radio' name='radio' value='T'/>
<input type = 'radio' disdabled id = 'radio' name = 'radio' value = 'F' />

how to get the value of the selected radio's value, trouble talking about some details

Sponsored Links

liujuange
2009-02-21 12:02:55
function test ()
{
var temp = document.getElementsByName ("radHot");
for (var i = 0; i <temp.length; i + +)
{
if (temp [i]. checked)
var intHot = temp [i]. value;
}
;
}

Baidu too much
document.getElementsByName this is to get a collection of the same name label
dragon5350
2009-02-21 12:14:43
document.getElementById ('radio_1'). value;
honzha99
2009-02-21 12:19:54
function check () {
for (var i = 0; i <radio.length; i + +) {
if (radio [i]. checked)
; alert (radio [i]. value);
}
}
xjjyaou11
2009-02-21 12:27:31
var chks = document.getElementsByName ("radio");
var nodes = $ A (chks);
nodes.each (function (node)
{
if (node.checked) {
....... This is what you want
}
});
DONALILY58
2009-02-21 12:40:54
in jsp page
<input type='radio' disdabled id='radio_1' name='ra_1' value='T'/>
<input type='radio' disdabled id='radio_2' name='ra_1' value='F'/>

jsp page is submitted or servlet to get the value:
String ra = request.getParameter ("ra_1");
txf334
2009-02-21 12:55:04


jsp pages in order to form submission
<form action ="aa.jsp" method="post">
<input type = 'radio' disdabled id = 'radio' name = 'radio' value = 'T' />
<input type = 'radio' disdabled id = 'radio' name = 'radio' value = 'F' />
</form>

aa.jsp or a servlet.

directly
<%
String radio = request.getParameter ("radio") ;/ / get is. Your selected radio value.

%>
dsdn2009
2009-02-21 01:02:43

how to get in JavaScript, but not in a servlet to get
lbc2006
2009-02-21 01:05:33
heroes, is obtained in JavaScript not to get in the background class
tomashhhh
2009-02-21 01:16:01
sorry wrong, document.getElementByName ('ra_1'). value
zyc279663662
2009-02-21 01:35:52

this should be is in the Baidu search on the right to know I can see, but can not seem to perform ah temp.length
yxs1123
2009-02-21 01:43:34

this is right, when I checked Baidu wrong in eclipse, Khan ......
mamanda
2009-02-21 02:00:37
ie the trash the place is various versions differ. Often run out!
yuhongjiaook
2009-02-21 02:14:43
ar val = $ ('input: radio [name = "_objId"]: checked'). val ();
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.