html Google Recaptcha - 应该使用此网站密钥在任何pagedemo.co页面上工作。示例:http://recaptcha.pagedemo.co/

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Google Recaptcha - 应该使用此网站密钥在任何pagedemo.co页面上工作。示例:http://recaptcha.pagedemo.co/相关的知识,希望对你有一定的参考价值。

<!-- START code for captcha HTML- Header -->
<style type="text/css">
#RecaptchaField1 {
  transform:scale(1.00);
  -webkit-transform:scale(1.00);
  -webkit-transform-origin:0 0;
  transform-origin:0 0;
}
</style>

<script>
    var label = 'Recaptcha';
    
    $(document).ready(function() {
        $('input[name="' + window.btoa(label) + '"]').val('0');
        console.log($('input[name="' + window.btoa(label) + '"]').val());

        ijQuery.validator.addMethod('captcha', function(value, element) {
            if (value.match('1')) {
                return true;
            } else {
                return false;
            }
        });
        ijQuery('form [name="' + base64_encode(label) + '"]').addClass('captcha');
        ijQuery.extend(ijQuery.validator.messages, {
            captcha: 'field: Please submit captcha first.'
        });
    }); //ready

    var recaptchaCallback = function() {
        $('input[name="' + window.btoa(label) + '"]').val('1');
        console.log($('input[name="' + window.btoa(label) + '"]').val());
    };

    var widgetId1;
    var onloadCallback = function() {
        // Renders the HTML element with id 'example1' as a reCAPTCHA widget.
        // The id of the reCAPTCHA widget is assigned to 'widgetId1'.

        widgetId1 = grecaptcha.render('RecaptchaField1', {
            'sitekey': '6Lcf4yQTAAAAAGDuW4gvzahRiaFXadFUQHhcdvJc',
            'callback': recaptchaCallback,
            'theme': 'light'
        });
    };
</script>
<!-- END code for captcha HTML- Header -->

<!-- START code for captcha HTML- Footer -->
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<!-- END code for captcha HTML- Footer -->

<div id="RecaptchaField1"></div>
<style type="text/css">
#RecaptchaField1 {
  transform:scale(1.20);
  -webkit-transform:scale(1.20);
  -webkit-transform-origin:0 0;
  transform-origin:0 0;
}
  #RecaptchaField2 {
  transform:scale(1.20);
  -webkit-transform:scale(1.20);
  -webkit-transform-origin:0 0;
  transform-origin:0 0;
}
</style>

<script>
	$( document ).ready( function() {
    	$( ".email-form .dynamic-button.btn" ).attr( "disabled", " " );
	}); //ready

  	var recaptchaCallback = function() {
    	console.log('calling back');
    	$( '.dynamic-button.btn' ).removeAttr( 'disabled' );
    };
  
      var widgetId1;
      var widgetId2;
      var onloadCallback = function() {
        // Renders the HTML element with id 'example1' as a reCAPTCHA widget.
        // The id of the reCAPTCHA widget is assigned to 'widgetId1'.
        
      widgetId1 = grecaptcha.render('RecaptchaField1', {
          'sitekey' : '6Lcf4yQTAAAAAGDuW4gvzahRiaFXadFUQHhcdvJc',
          'callback' : recaptchaCallback,
          'theme' : 'light'
        });
        
      widgetId2 = grecaptcha.render('RecaptchaField2', {
          'sitekey' : '6Lcf4yQTAAAAAGDuW4gvzahRiaFXadFUQHhcdvJc',
          'callback' : recaptchaCallback,
          'theme' : 'light'
        });
      };

</script>


<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>


<div id="RecaptchaField1"></div>


<div id="RecaptchaField2"></div>
<style>
    .g-recaptcha {
        transform:scale(0.90); //customise width
        transform-origin:0 0;
      	z-index: 11500000 !important; //z-index for pop-up
    }
</style>

<script>
	$( document ).ready( function() {
    	$( ".email-form .dynamic-button.btn" ).attr( "disabled", " " );
	}); //ready
  
  	function recaptchaCallback() {
    	console.log('calling back');
    	$( '.dynamic-button.btn' ).removeAttr( 'disabled' );
    }
</script>
<script src="https://www.google.com/recaptcha/api.js"></script>
<div class="g-recaptcha" data-callback="recaptchaCallback" data-sitekey="6Lcf4yQTAAAAAGDuW4gvzahRiaFXadFUQHhcdvJc"></div>

以上是关于html Google Recaptcha - 应该使用此网站密钥在任何pagedemo.co页面上工作。示例:http://recaptcha.pagedemo.co/的主要内容,如果未能解决你的问题,请参考以下文章

更改新的 Google Recaptcha (v2) 宽度

新的 Google ReCaptcha 实施和提交前检查

由于IPv6问题导致Google Recaptcha检查超时 - IIS上的php

Google reCaptcha v3 与 google reCaptcha Enterprise

css 将Google Recaptcha显示为#css #recaptcha #center

css 将Google Recaptcha显示为#css #recaptcha #center