获取一组radio按钮选中的值Value
生活随笔
收集整理的這篇文章主要介紹了
获取一组radio按钮选中的值Value
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、效果
?
2、HTML代碼
?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="MvcAppTest.WebForm6" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title></title><script src="Easyui/jquery-1.7.2.min.js"></script><script type="text/javascript"> function setCheck(pd) {var radios = document.getElementsByName("address");for (var i = 0; i < radios.length; i++) { if (radios[i].value==pd){radios[i].checked = true;}}}function show() {var radios = document.getElementsByName("address");for (var i = 0; i < radios.length; i++) {if (radios[i].checked) {alert(radios[i].value);}}}</script> </head> <body><form id="form1" runat="server"><div><input type="radio" name="address" value="0" checked="checked" />蘋果 <input type="radio" name="address" value="1" />香蕉 <input type="radio" name="address" value="2" />葡萄<div><input type="button" onclick="setCheck(1)" value="設置選中狀態" /></div><div><input type="button" onclick="show()" value="獲取選中的值" /></div></div> </form> </body> </html>?
轉載于:https://www.cnblogs.com/net064/p/10239700.html
總結
以上是生活随笔為你收集整理的获取一组radio按钮选中的值Value的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Composer切换到Laravel-C
- 下一篇: MyEclipse导入eclipse的w