0

嗨,有一个表单要在 jquery 插件“openid”的帮助下提交。现在,当我点击 google_button 时,一切正常,但是当我点击 aol 时,它将打开对话框并提交表单(当 form.submit 返回 false 时注释掉)。当我删除评论时,aol 将正常工作,只有 aol 对话框打开并且没有提交表单,但在这种情况下也不会提交谷歌表单。

请帮帮我

==================================================== ===============================

<form action="example.php" method="post" >   
<input type="image" src="images/google_button.png" id='https://www.google.com/accounts/o8/id' class="google"/> 
          <input type="image" src="images/AOL_button.png" id='http://openid.aol.com/' class='aol' />
</form>

==================================================== ===============================

 <script type="text/javascript">  
      $(document).ready(function(){
        $('form').openid(); 
      })
    </script>

==================================================== ===============================

(function($){
  $.fn.openid = function() {
    $('input').click(function(e){
      var provider = $(this).attr('class');
     if (provider == 'aol') {
        $("#dialog").dialog();
         /*$('form').submit(function(){
             return false;   
    })*/
     }
     else{
      var provider_url = $(this).attr('id');  //get id
      var myinput = $('<input type="hidden" name="provider_url"/>').val(provider_url);
      $('form').append(myinput);
      $('form').submit();
    }  
    })
  }
})(jQuery);

==================================================== ==============================

4

2 回答 2

0

尝试在if else施工后发送表格。

于 2012-05-02T08:31:53.383 回答
0
(function($){
  $.fn.openid = function() {
    $('input').click(function(e){
      var provider = $(this).attr('class');
     if (provider == 'aol') {
        $("#dialog").dialog();
         /*$('form').submit(function(){
             return false;   
    })*/
  ***return false;***   //add return false in this section
     }
     else{
      var provider_url = $(this).attr('id');  //get id
      var myinput = $('<input type="hidden" name="provider_url"/>').val(provider_url);
      $('form').append(myinput);
      $('form').submit();
    }  
    })
  }
})(jQuery);
于 2012-05-02T10:25:21.383 回答