简体   繁体   English

改变Recaptcha的主题?

[英]Change the theme of Recaptcha?

I use the Following script for change recaptcha in asp.net with c# server side.But this code Didn't Work. 我使用以下脚本在asp.net中使用c#server side更改recaptcha。但是这段代码没有用。 How to change color or theme of the ReCaptcha? 如何改变ReCaptcha的颜色或主题?

 <script type="text/javascript">
            var RecaptchaOptions = {theme : 'White'};
       </script>

I think you are just writing the name of the theme in wrong way, just try White with a small 'w'. 我认为你只是以错误的方式写出主题的名称,只需用一个小的'w'来尝试White。

<script type="text/javascript">
            var RecaptchaOptions = {theme : 'white'};
</script>

See this link for exact working code: 请参阅此链接以获取准确的工作代码

https://developers.google.com/recaptcha/docs/customization https://developers.google.com/recaptcha/docs/customization

George Siggouroglou's second method for asp.net is a charm George Siggouroglou对asp.net的第二种方法是魅力

I couldn't seem to set the theme as instructed in https://developers.google.com/recaptcha/docs/customization - placed the js above the form containing the recaptcha control - but adding the theme attribute directly into the recaptcha code as George explained: 我似乎无法按照https://developers.google.com/recaptcha/docs/customization中的说明设置主题 - 将js放在包含recaptcha控件的表单上方 - 但将主题属性直接添加到recaptcha代码中乔治解释说:

<recaptcha:RecaptchaControl
    ID="recaptcha"
    runat="server"
    PublicKey="your-public-key"
    PrivateKey="your-private-key"
    Theme="white"
/>

works. 作品。

U used the capital W instead of small ie w Try this U使用大写W而不是小w即试试这个

Change the theme and try 改变主题并尝试

<script type="text/javascript">
 var RecaptchaOptions = {
    theme : 'white'
    /*WE CAN USE FOLLOWING THEME TO CHANGE THE COLOR OF RECAPTHCA*/
    /*red,white,blackglass,clean'*/

    /*lang :'es';*/ //used to set the language
 };
 </script>

If you are using asp.net and if you are using the recapctcha for asp.net control , then if you want to change the theme (red(default),white,blackglass,clean) there is two ways. 如果您使用的是asp.net,并且如果您使用recapctcha进行asp.net控件 ,那么如果您想要更改主题(红色(默认),白色,黑色,干净),有两种方法。

Way no1, 方式1,

To make the reCAPTCHA widget display a different theme, you first need to add the following 要使reCAPTCHA小部件显示不同的主题,首先需要添加以下内容
code in your main HTML page anywhere before the element where reCAPTCHA appears 主要HTML页面中的代码,在显示reCAPTCHA的元素之前的任何位置
(this will not work if placed after the main script where reCAPTCHA is first invoked): (如果放在首次调用reCAPTCHA的主脚本之后,这将不起作用):

<script type="text/javascript">
    var RecaptchaOptions = {
        theme : 'theme_name'
    };
</script>

Way no2: 方式2:

Add the property 'Theme' to the recapcha asp.net control: 将属性'Theme'添加到recapcha asp.net控件:

<recaptcha:RecaptchaControl
    ID="recaptcha"
    runat="server"
    PublicKey="your-public-key"
    PrivateKey="your-private-key"
    Theme="white"
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM