zoukankan      html  css  js  c++  java
  • 处理radio按钮

    
    <script src="jquery-1.6.4.js" type="text/javascript"></script>
    <input>aaaaaaaa
    <input name="Fruit1" type="radio" checked />苹果
    <input name="Fruit2" type="radio" checked  />橘子
    <input name="Fruit3" type="radio" value="" />香蕉
    <script>
    var checkedValue;
    var elements = document.getElementsByTagName('input');
    for (var i=0;i<elements.length;i++){
        console.log(elements[i].type);
        console.log(elements[i].name);
        console.log(elements[i].checked);
     if (elements[i].type == 'radio' && elements[i].name == 'Fruit2' && elements[i].checked){
        alert('aaaa');
     }
    }
    </script>
    
    
    <script src="jquery-1.6.4.js" type="text/javascript"></script>
    <input>aaaaaaaa
    <input name="Fruit1" type="radio" checked />苹果
    <input name="Fruit2" type="radio" checked  />橘子
    <input name="Fruit3" type="radio" value="" />香蕉
    <script>
    console.log($('input:radio[name="Fruit2"]:checked').val();
    </script>
    
    
    <script src="jquery-1.6.4.js" type="text/javascript"></script>
    <input>aaaaaaaa
    <input name="Fruit1" type="radio" checked />苹果
    <input name="Fruit2" type="radio" checked   />橘子
    <input name="Fruit3" type="radio" value="" />香蕉
    <script>
    if ($('input:radio[name="Fruit2"]:checked').val()){
    alert('aaa');
    };
    </script>
  • 相关阅读:
    pyqt笔记1模块 信号和插槽
    pyqt5 eric6 pyqt5-tools
    转入Python3.5
    ARM伪指令
    ARM MOV PC加8
    所有JTAG集成电路都应该支持菊花链
    冯诺依曼存储子系统的改进
    [分享]Active-HDL 9.2 安装
    运行python脚本后台执行
    scala实验 模拟图形绘制
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348598.html
Copyright © 2011-2022 走看看