0

这是我的代码。即使我选择“是”,我得到的总是“不”这是我的 html 代码。在 firebug 控制台中进行测试时,它工作正常。我也尝试过 .each 函数,但它仍然没有任何价值。有时它需要正确的复选框值,但它会继续取该值几次

           <form  >
            <table width="900" cellpadding="5" border="0" >


              <tr>
                 <td width="30"><input type="radio"  class="radio_bg" name="profile_rpt_bg"    value="yes"></td>
                 <td>Repeat Background</td>
           </tr>

       <tr class="graybackgroundlight">
        <td><input   type="radio" name="profile_rpt_bg" class="radio_bg"   checked="checked"   value="no"></td>
         <td>Do not Repeat Background</td>
       </tr>
         </table>

       </form>

这是我的 JavaScript 代码

          $(document).ready(function(){


    $('#file_upload_bg').uploadify({
     'formData'      : {

         'artist_id' : '<?php echo $artist_details['id']; ?>',
      'username' : '<?php echo $artist_details['username'];?>',
      'rpt': $("input[name='profile_rpt_bg']:checked").val(),
      'column' : 'profile_bg'


      },
     'auto'          : false,
     'multi'         : false,   
     'fileTypeDesc'  : 'Image Files',
     'fileTypeExts'  : '*.jpg; *.png',
     'swf'           : 'uploadify.swf',
     'uploader'      : 'artist_uploadify.php' ,

      'onUploadSuccess' : function(file, data, response) 


      {
          alert(data);

        $("#container").notify("create", {
        title: 'Success',
        text: file.name+' Uploaded with success'
         });      







      }
      // Your options here

    }); //uploadify ends


    });
4

2 回答 2

1

解决了......

              'onUploadStart' : function(file) 
              {
                     $('#file_upload_bg').uploadify("settings", "formData", {"rpt":    $("input[name='profile_rpt_bg']:checked").val()});
              },

在uploadify中添加这个

实际上是uploadify插件问题而不是jquery ..

无论如何谢谢

于 2012-08-07T09:53:20.593 回答
0

检查它在这个小提琴中的工作正常......

$('input[name=profile_rpt_bg]').on('click', function() {
    alert( $('input[name=profile_rpt_bg]:checked').val() );
});​

小提琴链接

于 2012-08-07T09:21:18.753 回答