jquery 控制图片实现checkbox复选框效果
来源:互联网 发布:阿里云客服怎么做 编辑:程序博客网 时间:2024/06/04 18:35
<include file="Public:header"/>
<script type="text/javascript">
jQuery(document).ready(function(){
//返回到当前页面、刷新当前页面时,以前选中的复选框所对应的图片事件
jQuery('input[type=checkbox]:checked').each(function(){
jQuery(this).nextAll('.checkbox_check').show();
jQuery(this).nextAll('.checkbox_none').hide();
});
//jQuery("input[type=checkbox]").attr("checked",false);
//服务选择页面提交事件
jQuery('.o_btn_submit').click(function(){
var data = new Array();
//var data = new Array();
jQuery('input[type=checkbox]:checked').each(function(){
data.push(jQuery(this).val());
});
if(data == ""){
alert('请选择需要的服务');
return false;
}
//location.href = "{lanrain::U('Yuyue/order',array('token'=>$_GET['token'],'data' =>'"+data+"','wecha_id'=>$_GET['wecha_id']))}";
var token = jQuery('#token').val();
var wecha_id = jQuery('#wecha_id').val();
location.href = "index.php?g=Wap&m=Yuyue&a=order&token="+token+"&data="+data+"&wecha_id="+wecha_id;
});
//checkbox单选按钮未选中事件
jQuery('.checkbox_none').click(function(){
jQuery(this).prevAll('#service_checkbox').prop('checked',true);
jQuery(this).hide();
jQuery(this).next('.checkbox_check').show();
});
//checkbox单选按钮选中事件
jQuery('.checkbox_check').click(function(){
jQuery(this).prevAll('#service_checkbox').prop('checked',false);
jQuery(this).hide();
jQuery(this).prev('.checkbox_none').show();
})
})
</script>
<style type="text/css">
/********************2014.6.4预约*****************************************/
.checkbox_none{
}
.checkbox_check{
}
</style>
<div class='serviceList' >
<section class="f_list i_list" >
<ul class="clearfix" id="f_list">
<volist name="list" id="list">
<li>
<div class="f_list_l">
<span>
<img src="{lanrain:$list.service_picurl}" />
<h3>{lanrain:$list.service_name}</h3>
<p class="tui_price ts2">价格:¥{lanrain:$list.service_price}</p>
</span><br>
<span style="float: left;">简介:{lanrain:$list.service_info}</span>
</div>
<div class="f_list_r">
<p>
<input id="service_checkbox" name='service_checkbox' value="{lanrain:$list.id}" type='checkbox' style="display: none;">
<img src='{lanrain::RES}/images/yuyue/checkboxNone.jpg' class='checkbox_none' style='padding-left:15px;float:left;width:20px;height:20px;'>
<img src='{lanrain::RES}/images/yuyue/checkboxCheck.jpg' class='checkbox_check' style='padding-left:15px;float:left;width:20px;height:20px;display: none;' >
<strong>预约</strong>
</p>
</div>
</li>
</volist>
</ul>
</section>
<div style='margin-bottom:60px;'>
<input type='button' class='o_btn_submit ts1' style='width:100%;height:35px;' value="提交">
</div>
<input type='hidden' id='token' name='token' value="{lanrain::$_GET['token']}">
<input type='hidden' id='wecha_id' name='wecha_id' value="{lanrain::$_GET['wecha_id']}">
</div>
</body>
<script type="text/javascript">
jQuery(document).ready(function(){
//返回到当前页面、刷新当前页面时,以前选中的复选框所对应的图片事件
jQuery('input[type=checkbox]:checked').each(function(){
jQuery(this).nextAll('.checkbox_check').show();
jQuery(this).nextAll('.checkbox_none').hide();
});
//jQuery("input[type=checkbox]").attr("checked",false);
//服务选择页面提交事件
jQuery('.o_btn_submit').click(function(){
var data = new Array();
//var data = new Array();
jQuery('input[type=checkbox]:checked').each(function(){
data.push(jQuery(this).val());
});
if(data == ""){
alert('请选择需要的服务');
return false;
}
//location.href = "{lanrain::U('Yuyue/order',array('token'=>$_GET['token'],'data' =>'"+data+"','wecha_id'=>$_GET['wecha_id']))}";
var token = jQuery('#token').val();
var wecha_id = jQuery('#wecha_id').val();
location.href = "index.php?g=Wap&m=Yuyue&a=order&token="+token+"&data="+data+"&wecha_id="+wecha_id;
});
//checkbox单选按钮未选中事件
jQuery('.checkbox_none').click(function(){
jQuery(this).prevAll('#service_checkbox').prop('checked',true);
jQuery(this).hide();
jQuery(this).next('.checkbox_check').show();
});
//checkbox单选按钮选中事件
jQuery('.checkbox_check').click(function(){
jQuery(this).prevAll('#service_checkbox').prop('checked',false);
jQuery(this).hide();
jQuery(this).prev('.checkbox_none').show();
})
})
</script>
<style type="text/css">
/********************2014.6.4预约*****************************************/
.checkbox_none{
}
.checkbox_check{
}
</style>
<div class='serviceList' >
<section class="f_list i_list" >
<ul class="clearfix" id="f_list">
<volist name="list" id="list">
<li>
<div class="f_list_l">
<span>
<img src="{lanrain:$list.service_picurl}" />
<h3>{lanrain:$list.service_name}</h3>
<p class="tui_price ts2">价格:¥{lanrain:$list.service_price}</p>
</span><br>
<span style="float: left;">简介:{lanrain:$list.service_info}</span>
</div>
<div class="f_list_r">
<p>
<input id="service_checkbox" name='service_checkbox' value="{lanrain:$list.id}" type='checkbox' style="display: none;">
<img src='{lanrain::RES}/images/yuyue/checkboxNone.jpg' class='checkbox_none' style='padding-left:15px;float:left;width:20px;height:20px;'>
<img src='{lanrain::RES}/images/yuyue/checkboxCheck.jpg' class='checkbox_check' style='padding-left:15px;float:left;width:20px;height:20px;display: none;' >
<strong>预约</strong>
</p>
</div>
</li>
</volist>
</ul>
</section>
<div style='margin-bottom:60px;'>
<input type='button' class='o_btn_submit ts1' style='width:100%;height:35px;' value="提交">
</div>
<input type='hidden' id='token' name='token' value="{lanrain::$_GET['token']}">
<input type='hidden' id='wecha_id' name='wecha_id' value="{lanrain::$_GET['wecha_id']}">
</div>
</body>
</html>
style{}中未写具体样式,而写在标签的style中,是因为css优先级的问题,也就是样式冲突,写在css文件中也未解决,为了节省时间,暂时写了标签的style中
0 0
- jquery 控制图片实现checkbox复选框效果
- jquery复选框checkbox实现删除
- jquery复选框checkbox实现删除
- jquery复选框checkbox实现删除
- jquery操作复选框checkbox
- JQuery checkbox复选框操作
- jquery操作复选框(checkbox)
- 【jQuery】:checkbox复选框选择器
- jquery操作复选框(checkbox)
- jquery操作复选框checkbox
- jquery操作复选框checkbox
- jquery 处理 CheckBox复选框
- Jquery操作checkbox复选框
- jquery实现复选框checkbox全选,取消全选
- 用jquery实现复选框checkbox的全选
- jquery实现复选框checkbox全选(完善)
- jquery实现复选框checkbox全选(完善)
- 使用jquery实现 checkbox复选框全选和全不选
- 算法杂货铺——k均值聚类(K-means)
- UVa OJ 455 Periodic Strings
- 送人玫瑰,手有余香!
- Android中proguard混淆第三方jar包及内部类
- Jquery表单验证
- jquery 控制图片实现checkbox复选框效果
- c++友元
- 关于冒泡排序(从大到小、从小到大)
- glib 简介
- 错误处理程序,如404
- 3D游戏中显示网页
- 分布式版本控制工具Git
- C++入门小程序代码
- 从天蓝春风。