选中复选框,如果通过jquery进行,则不会拾取 $(“#提交#加载”)。单击(函数(){ var profilename=$(“#搜索#u配置文件选项:选中”).attr(“值”); var data='profilename='+profilename+'&user_id='+; 警报(数据); $.ajax({ //这是处理数据和发送邮件的php文件 url:“getprofile.php”, 类型:“POST”, 数据:数据, cache:false, 成功:函数(html){ 警报(html); var dia_info=html.split('~'); //$('diamond_options')[0].reset(); var dia_id=$(':复选框:checked.ds_nobg').map(函数(){ 返回此.id; }).get().join(','); 警报(“diatype----”+直径id); //警报(直径id.长度); 如果(直径id.长度>0) { 变量dia_id_arr=dia_id.split(','); 对于(var j=0;j0) { 变量dia_id_arr=dia_info[34]。拆分(','); 对于(var l=0;l
而言,最好处理最新的jqueryv1.6方法和选中复选框,如果通过jquery进行,则不会拾取 $(“#提交#加载”)。单击(函数(){ var profilename=$(“#搜索#u配置文件选项:选中”).attr(“值”); var data='profilename='+profilename+'&user_id='+; 警报(数据); $.ajax({ //这是处理数据和发送邮件的php文件 url:“getprofile.php”, 类型:“POST”, 数据:数据, cache:false, 成功:函数(html){ 警报(html); var dia_info=html.split('~'); //$('diamond_options')[0].reset(); var dia_id=$(':复选框:checked.ds_nobg').map(函数(){ 返回此.id; }).get().join(','); 警报(“diatype----”+直径id); //警报(直径id.长度); 如果(直径id.长度>0) { 变量dia_id_arr=dia_id.split(','); 对于(var j=0;j0) { 变量dia_id_arr=dia_info[34]。拆分(','); 对于(var l=0;l,jquery,dom,checkbox,checked,Jquery,Dom,Checkbox,Checked,而言,最好处理最新的jqueryv1.6方法和 @Reigel-你发布了一条空评论?我没有评论..我编辑了你的帖子…将$(#round)修改为$('#round')打字:选择器周围没有引号..否则它对我来说没问题:@supertramp yours对我来说没问题,但是对我的问题做了进一步的修改。。。 $("#submit_load").click(function() { var profilename =$("#search_profiles option:selected").
@Reigel-你发布了一条空评论?我没有评论..我编辑了你的帖子…将
$(#round)
修改为$('#round')
打字:选择器周围没有引号..否则它对我来说没问题:@supertramp yours对我来说没问题,但是对我的问题做了进一步的修改。。。
$("#submit_load").click(function() {
var profilename =$("#search_profiles option:selected").attr("value");
var data='profilename='+profilename+'&user_id=' + <?=$user_id;?>;
alert(data);
$.ajax({
//this is the php file that processes the data and send mail
url: "getprofile.php",
type: "POST",
data: data,
cache: false,
success: function (html) {
alert(html);
var dia_info = html.split('~');
//$('#diamond_options')[0].reset();
var dia_id = $(':checkbox:checked.ds_nobg').map(function() {
return this.id;
}).get().join(',');
alert("diatype----"+dia_id);
// alert(dia_id.length);
if(dia_id.length>0)
{
var dia_id_arr = dia_id.split(',');
for(var j=0;j<dia_id_arr.length;j++)
{
var chk_id = dia_id_arr[j];
var diashape_chk = '#' + chk_id;
var bg_id='#'+chk_id+'1';
var shape_id='#'+chk_id+'-1';
var shape_class_on=chk_id+'_1_on';
var shape_class_off=chk_id+'_1';
// alert(chk_id+'---'+diashape_chk+'---'+bg_id+'---'+shape_id+'---'+shape_class_on+'---'+shape_class_off );
// alert(dia_id_arr_sp[0]+'---'+dia_id_arr_sp[1]+'---'+diashape_chk+'---'+diashape+'---'+remclass+'---'+addcls+'---'+rembg );
// alert(diashape);
$(shape_id).removeClass(shape_class_on);
$(shape_id).addClass(shape_class_off);
$(bg_id).removeClass('ds_bg_hi' );
$(bg_id).addClass('ds_nobg' );
$(diashape_chk).removeAttr('checked') ;
if ($(shape_id).hasClass(shape_class_off)) {
alert("helllo---"+j+"---"+shape_id);
}
}
}
if(dia_info[34].length>0)
{
var dia_id_arr = dia_info[34].split(',');
for(var l=0;l<dia_id_arr.length;l++)
{
var chk_id = dia_id_arr[l];
var diashape_chk = '#' + chk_id;
var bg_id='#'+chk_id+'1';
var shape_id='#'+chk_id+'-1';
var shape_class_on=chk_id+'_1_on';
var shape_class_off=chk_id+'_1';
if ($(shape_id).hasClass(shape_class_off)) {
alert("ddddd---"+l+"---"+shape_id);
}
// alert(chk_id+'---'+diashape_chk+'---'+bg_id+'---'+shape_id+'---'+shape_class_on+'---'+shape_class_off );
$(shape_id).removeClass(shape_class_off);
$(shape_id).addClass(shape_class_on);
$(bg_id).removeClass('ds_nobg' );
$(bg_id).addClass('ds_bg_hi' );
$(diashape_chk).attr('checked', 'checked') ;
if ($(shape_id).hasClass(shape_class_on)) {
alert("eeee---"+l+"---"+shape_id);
}
}
}
});
});
$("#round").prop("checked", true);
$('#round').removeProp('checked') ;