TA的每日心情 | 郁闷 2021-2-3 13:46 |
---|
签到天数: 14 天 [LV.3]偶尔看看II
|
<!-- script代码,如果需要引用js文件,请使用与HTML中相同的方式。 -->
<script type="text/javascript">
//必填字段集
var btzd = "field9071" ;
//必填字段后图标
var textValue = "<IMG align=absMiddle src='/images/BacoError_wev8.gif' />" ;
//a字段对应的字段ID,根据实际情况修改
var field_a = "field9071" ;
//b字段对应的字段ID,根据实际情况修改
var field_b = "field9072" ;
//c字段对应的字段ID,根据实际情况修改
var field_c = "field9073" ;
//页面加载事件
jQuery(document).ready(function() {
btzd = jQuery("input[name='needcheck']").val();
//给a字段change绑定事件
jQuery("#"+field_a).bind( 'change',function (){
linkageMust();
} );
linkageMust();
});
//字段联动必填
function linkageMust(){
var a_v = jQuery("#"+field_a).val();
var fieldIds = "" ;
if(a_v >= '5'){
//添加必填
jQuery("#"+field_b+ "span").html(textValue);
jQuery("#"+field_b).attr('viewtype','1');
//取消必填
jQuery("#"+field_c+ "span").html('' );
jQuery("#"+field_c).attr('viewtype','0');
//必填字段id
fieldIds = btzd + "," + field_a ;
jQuery( "input[name='needcheck']").val(fieldIds);
}else if(a_v == '10' ){
//添加必填
jQuery("#"+field_c+ "span").html(textValue);
jQuery("#"+field_c).attr('viewtype','1');
//取消必填
jQuery("#"+field_b+ "span").html('' );
jQuery("#"+field_b).attr('viewtype','0');
//必填字段id
fieldIds = btzd + "," + field_c ;
jQuery( "input[name='needcheck']").val(fieldIds);
}else{
//取消必填
jQuery("#"+field_b+ "span").html('' );
jQuery( "#"+field_c+"span" ).html('');
}
}
</script>
|
|