js获取radio选中索引值
<form name="form1" onsubmit="return foo()">
<input type="radio" name="radiogroup1">
<input type="radio" name="radiogroup1">
<input type="radio" name="radiogroup1">
<input type="radio" name="radiogroup1">
<input type="radio" name="radiogroup1">
<input type="radio" name="radiogroup1">
<input type="submit">
</form>
<script>
function foo(){
for(i=0;i<document.form1.radiogroup1.length;i++)
{
if (document.form1.radiogroup1[i].checked){
alert(i);
return i;
}
}
return false;
}
</script>
js获取radio选中索引值的更多相关文章
- jquery 获取radio选中的值
如下案例:常用方法 1.获取选中值,三种方法都可以: $('input:radio:checked').val(): $("input[type='radio']:checked" ...
- jquery怎么获取radio选中的值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- JS获取select选中的值,所有option值
<select name="myselect" id="myselect"> <option value="2042"&g ...
- 函数语法:原生JS获取数组的索引值index
var lis = document.getElementsByTagName("li"); for(var i=0;i<lis.length;i++) { lis[i].i ...
- Jquery获取radio选中的值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 用JS获取DropDownList选中得值
HTML: <asp:DropDownList ID="DropdownList1" runat="server" AutoPostBack=" ...
- JS获取select选中的值
var oSel=oFl.getElementsByTagName('select')[0]; oSel.onchange=function(){ var indexselect=oSel.selec ...
- jquery获取select选中的值
http://blog.csdn.net/renzhenhuai/article/details/19569593 误区: 一直以为jquery获取select中option被选中的文本值,是这样写的 ...
- Jquery 获取 radio选中值,select选中值
随着Jquery的作用越来越大,使用的朋友也越来越多.在Web中,由于CheckBox.Radiobutton .DropDownList等控件使用的频率比较高,就关系到这些控件在Jquery中的操作 ...
随机推荐
- 在Microsoft Expression Blend 2 中绘制圆角矩形按钮
原文:在Microsoft Expression Blend 2 中绘制圆角矩形按钮 /* 声明:转载请保留此信息:http://www.BrawDraw.com, http://www.ZPXP.c ...
- img前置显示屏装load图片
只需要设置img的background能够 <img src="" alt="" class="detailImg" > cs ...
- 楼塔当天领袖acm心理(作为励志使用)
楼主个人博客:吉尔博客 假期空闲的时候使用.这些年来GCJ.ACM,TopCoder 的一个号码的一重要的比赛的参与 回顾.GCJ2006 的回顾,今天时间上更早一些吧,我如今还清晰记得3 年 前.我 ...
- if-then和if-then-else声明
1.使用if-then声明 结构化命令,主要类型为if-then声明.if-then例如,下面的语句格式: if command then commands fi 假设你在使用其它编程语言的if-th ...
- Invalid default value for 'created_at'
https://github.com/laravel/framework/issues/15144 https://stackoverflow.com/questions/30555844/larav ...
- XF 表视图添加和删除行
using System;using Xamarin.Forms;using Xamarin.Forms.Xaml; [assembly: XamlCompilation (XamlCompilati ...
- 【msdn wpf forum翻译】TextBlock等类型的默认样式(implicit style)为何有时不起作用?
原文:[msdn wpf forum翻译]TextBlock等类型的默认样式(implicit style)为何有时不起作用? 原文链接:http://social.msdn.microsoft.co ...
- 我们错过了那么多机会,怎么办(就是预见未来的能力,并且要去做、要去投入,所以要主动学习、储备、选择,要不断的思考)good
那天在IT职业咨询QQ群里聊天,提到腾讯.阿里,我说跟着这两家公司从小到大的朋友,都获得了不菲的回报,成了富翁或者财务自由了. 有群友感叹说:“是啊,我们错过了那么多机会.” 看到这句话,我心里一动, ...
- Ubuntu16.04下配置laravel
参考 http://tecadmin.net/install-laravel-framework-on-ubuntu/# 本人亲试,完全正确 注意: Step 4 – Set Encryption K ...
- 02ython基础知识(一)
Python基础知识(一) 变量 name='monkeyfx' 变量定义的规则: 变量名只能是 字母.数字或下划线的任意组合 变量名的第一个字符不能是数字 以下关键字不能声明为变量名: ['and' ...