<input type="radio" class="is" name="why3185" value="0">0</p><input type="radio" class="is" name="why1856" value="1">1</p><input type="radio" class="is" name="why31856" checked value="2">2</p>
怎么样获得这组radio被选中的值??
怎么样获得这组radio被选中的值??
解决方案 »
- 求php代码:实现点击网站上的js广告代码给会员增加积分功能
- embed高分问题【100分】
- 有没有好的表格控件介绍,最好是ActiveX版本的
- javascript如何将<img src=xxx.jpg>替换为<img src=xxx.jpg onload='javascript:if(thi
- 求javascript上传图片的代码,最好是html页面
- 父窗口和子窗口参数传递问题
- 动态添加行后,填入数据,怎提交数据呢?
- Jquery解析xml文档
- 求一简单问题:关于如何利用文本框获取下拉菜单选择的内容,详情请看内容。
- 在JavaScript中如何对整个页面进行监测,十万火急!!!!!
- jquery easyui demo 在vs中运行错误
- 大虾帮忙啊ognl.InappropriateExpressionException: Inappropriate OGNL expression: 1
<html>
<head>
<title>无标题页</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<input type="radio" class="is" name="why3185" value="0">0</p><input type="radio" class="is" name="why1856" value="1">1</p><input type="radio" class="is" name="why31856" checked value="2">2</p> <script>
alert( $('.is:checked').val() )
</script>
</body>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".is").bind("click", function () {
alert($('.is:checked').val());
})
});
</script>
</head>
<body>
<input type="radio" class="is" name="why" value="0">0</p>
<input type="radio" class="is" name="why" value="1">1</p>
<input type="radio" class="is" name="why" checked="checked" value="2">2</p>
</body>
</html>楼主我认为你的代码似乎有点问题 - - 既然是一组Radio,name属性应该都一样,才能实现单选啊 = =
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
var obj = document.getElementsByTagName('input');
var demo = document.getElementById('demo');
for (var i = 0; i < obj.length; i ++) {
if (obj[i].className == 'is') obj[i].onclick = function() {
var result = [];
for (var j = 0; j < obj.length; j ++) if (obj[j].checked) result.push(obj[j].value);
demo.innerHTML = result.join(',');
}
}
}
</script>
</head><body>
<input type="radio" class="is" name="why3185" value="0">0<br />
<input type="radio" class="is" name="why1856" value="1">1<br />
<input type="radio" class="is" name="why31856" checked value="2">2<div id="demo"></div>
</body>
</html>
<input type="radio" class="is" name="why1856" value="1">1<br />
<input type="radio" class="is" name="why31856" checked value="2">2有俩组的怎么办??
<input type="radio" class="is" name="why1856" value="1">1<br />
<input type="radio" class="is" name="why31856" checked value="2">2存放在value的值中,怎么取出来!!
<input type="radio" class="is" name="why1856" value="1">1<br />
<input type="radio" class="is" name="why31856" checked value="2">2
这个!!
<html>
<head>
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<style type="text/css">
</style>
<script type="text/javascript">
$(function(){
$("#Test").click(function(){
alert($("input[class='is']:checked").val())
});
});
</script>
</head>
<body>
<form>
<input type="radio" class="is" name="why3185" value="0">0</br>
<input type="radio" class="is" name="why3185" value="1">1</br>
<input type="radio" class="is" name="why3185" checked value="2">2</br>
<input type="button" value="Test" id="Test"/>
</form>
</body>
</html>