radio选择
input标签radio单选

<tr>
<th style="font-weight: bolder;text-align: right;width:18%" >是否包邮:</th>
<td style="width:32%; text-align:left;">
<input id="postageFree1" type="radio" name="postage.postageFree" value="1" onclick="changePostageFree(this.value)" checked="checked"/>包邮
<input id="postageFree2" type="radio" name="postage.postageFree" value="2" onclick="changePostageFree(this.value)" />自定义运费
</td>
</tr>
<tr id="MethodsTR" hidden="hidden">
<th style="font-weight: bolder; text-align: right;width:18%" >计价方式:</th>
<td style="width:32%; text-align:left;">
<input id="valuationMethods1" type="radio" name="postage.valuationMethods" value="1" onclick="changeMethods(this.value)" />按件数
<input id="valuationMethods2" type="radio" name="postage.valuationMethods" value="2" checked="checked" onclick="changeMethods(this.value)" />按重量
<input id="valuationMethods3" type="radio" name="postage.valuationMethods" value="3" onclick="changeMethods(this.value)"/>按体积
</td>
</tr>
<tr id="ruleTR" hidden="hidden">
<th width="18%" align="right">默认规则: </th>
<td align="left" colspan="3">
<input type="text" id="defaultRulesA" name="postage.defaultRulesA" />
<span id="rulesA" >kg内</span>
<input type="text" id="defaultRulesB" name="postage.defaultRulesB" />
<span id="rulesB">元, 每增加</span>
<input type="text" id="defaultRulesC" name="postage.defaultRulesC" />
<span id="rulesC">kg, 增加运费</span>
<input type="text" id="defaultRulesD" name="postage.defaultRulesD" />元
</td>
</tr>
根据是否包邮显示不同的计价方式,根据不同的计价方式展示不同的ABCD值
// 修改是否包邮check
function changePostageFree(val){
if(val == 1){
$('#postageFree1').attr('checked', 'true');
$("#postageFree2").attr("checked",false);
$("#MethodsTR").hide();
$("#ruleTR").hide();
$("#ruleAdd").hide();
$("#ruleName").hide();
$(".imgs").hide(); }else{
$("#postageFree2").attr('checked','true');
$('#postageFree1').attr("checked",false);
$("#MethodsTR").show();
$("#ruleTR").show();
$("#ruleAdd").show();
$("#ruleName").hide();
$(".imgs").show();
}
}
// 修改计价方式
function changeMethods(num){
if(num == 1){
if($("#valuationMethods1").prop('checked')){
$("#valuationMethods1").attr("checked", true);
$("#valuationMethods2").attr("checked", false);
$("#valuationMethods3").attr("checked", false);
$("#rulesA").html("件内");
$("#rulesB").html("元, 每增加");
$("#rulesC").html("件, 增加运费");
$("#ruleNameA").html("第一件");
$("#ruleNameC").html("续件");
}else{
$("#valuationMethods1").attr("checked", false);
}
}else if (num == 2){
if( $("#valuationMethods2").prop('checked')){
$("#valuationMethods2").attr("checked", true);
$("#valuationMethods1").attr("checked", false);
$("#valuationMethods3").attr("checked", false);
$("#rulesA").html("kg内");
$("#rulesB").html("元, 每增加");
$("#rulesC").html("kg, 增加运费");
$("#ruleNameA").html("首重量(kg)");
$("#ruleNameC").html("续重量(kg)");
}else{
$("#valuationMethods2").attr("checked", false);
}
}else{
if( $("#valuationMethods3").prop('checked')){
$("#valuationMethods3").attr("checked", true);
$("#valuationMethods1").attr("checked", false);
$("#valuationMethods2").attr("checked", false);
$("#rulesA").html("m³");
$("#rulesB").html("元, 每增加");
$("#rulesC").html("m³, 增加运费");
$("#ruleNameA").html("首体积(m³)");
$("#ruleNameC").html("续体积(m³)");
}else{
$("#valuationMethods3").attr("checked", false);
}
}
}
radio选择的更多相关文章
- jQuery获取Radio选择的Value值||两个select之间option的互相添加操作(jquery实现)
jQuery获取Radio选择的Value值: 1. $("input[name='radio_name'][checked]").val(); //选择被选中Radio的Val ...
- 单选框radio 选择问题
<input type="radio" name="test"/> <input type="radio" name= ...
- radio选择事件 onchange事件 onclick事件
单选框按钮(radio)选择事件怎么设置呢? 既可以在radio标签里设置onclick事件实现,也可以设置它的onchange事件实现,效果一样,代码如下: <input id="r ...
- 页面中的radio选择适合的非空判断
var cyjb=$('input:radio[name="jcrwModel.cyjb"]:checked').val(); if(cyjb==n ...
- 【转】jQuery获取Select option 选择的Text和Value
获取一组radio被选中项的值:var item = $('input[name=items][checked]').val();获取select被选中项的文本:var item = $(" ...
- Jquery常用radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关设置
获取一组radio被选中项的值:var item = $('input[name=items][checked]').val(); 获取select被选中项的文本:var item = $(" ...
- jquery 获取Select option 选择的Text和Value
jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关设置 获取一组radio被选中项的值:var item = $(' ...
- checkbox和radio使用
jQuery获取Radio选择的Value值: jQuery C# VB C++ Java jQuery设置Radio的Value值: 语法解释: 1. $("input[n ...
- radio与checkbox
最近一直在学习Javascript与asp.net MVC4,每天都在跟着书学习.这样总感觉自己看的很抽象,没有点实际的意义.而且,每次看的东西很容易忘记,所以打算在这里记录自己的学习笔记. Java ...
随机推荐
- PyEngine3D
git clone https://github.com/ubuntunux/PyEngine3D cd PyEngine3D pip install -r requirements.txt pyth ...
- Mongodb 创建管理员帐号与普通帐号
数据库操作权限 readAnyDatabase 任何数据库的只读权限 userAdminAnyDatabase 任何数据库的读写权限 userAdminAnyDatabase 任何数据库用户的管理权限 ...
- idea使用教程(2)
目录: 1. open和import的区别 2.修改虚拟机配置信息 3.安装目录和设置目录 1. open和import的区别 open:如果本身就是idea项目,则可以直接open打开; impor ...
- Algorithm 算法基础知识(未完成
基础概念不讲,记录课上关键部分 时间复杂度(Time Complexity) 算法所需要花的时间 比较时间复杂度(主要看问题的规模) 时间频度(算法执行次数)T(n)和T(n1),如果两个时间频度为等 ...
- Python day2_int以及string的常见方法1_笔记
Python中,主要的基本类型有:数字(int型).字符串(string型).列表(list型).元祖(tuple型).字典(direct型).布尔值(boolean型) 1.int型 1.强转int ...
- 学习笔记16—Matlab 基础集
1.常用相关 [r, p] = corr(X,Y), [r, p] = partialcorr(X,Y, Z) , 其中Z是协变量. 2.TD_age = importdata('F:\BrainAg ...
- nRF52832-PPI部分学习
PPI部分学习思维导图 PPI原理 1.1PPI简介 PPI实现的就是通过初始化配置,将不同外设的事件和任务连接起来,让事件自动去触发任务的功能,PPI有多个通道, 每个通道包含一个EEP和TEP,使 ...
- css特效博客
1. 前端网上: e344657992 http://www.qdfuns.com/notes/15477/02cb463c28d9fe69ee0bc804448b8316.html
- Go语言学习之1 基本概念、环境搭建、第一个Go程序
一.环境搭建 见我的这篇博客 https://www.cnblogs.com/xuejiale/p/10258244.html 二.golang语言特性1. 垃圾回收 1) 内存自动回收,再也不 ...
- English trip V1 - B 5.Is It Cold Outside? 外面很冷? Teacher:Corrine Key: weather
In this lesson you will learn to talk about the weather. 本节课将学习到关于天气 课上内容(Lesson) 词汇(Key Word ) # 关于 ...