【问题标题】:Captcha MVC 4 refresh button is is not showing验证码 MVC 4 刷新按钮未显示
【发布时间】:2014-06-05 19:15:40
【问题描述】:

我正在使用 Captcha Mvc 4.0 (Vyacheslav)

这是我的代码:

@Html.Captcha("Refresh", "Enter the text shown in imag"
                , 5, "Is required field.", false)

这就是问题所在:

运行流畅但没有显示刷新按钮,这是由于style="display:none;"

<a href="#CaptchaImage" id="5f88fe4e11e743c6a8a8430de57cfcff"  
  onclick="______f9192ce4675540129ec6f99adc316d82________()"   
  style="display:none;">Refresh</a>

如何让它可见?

【问题讨论】:

    标签: asp.net-mvc-4 captcha


    【解决方案1】:

    在代码中,他做了一个 .show() ,只有在加载 jquery 时才有效。要解决此问题,请在调用方法之前导入 jquery,或者执行以下操作,将标记和脚本分开。

    @{
        var captcha = @Html.Captcha("Refresh", "Enter the text shown in imag"
                    , 5, "Is required field.", false)
    }
    
    @captcha.RenderMarkup()
    
    @section scripts
    {
        @captcha.RenderScript()
    }
    

    【讨论】:

    • @captcha.RenderMarkup() 没什么,但感谢您的回答,我已解决。
    【解决方案2】:

    JQuery 文件需要在该行之前加载

    @Html.Captcha(....
    

    一切顺利!

    【讨论】:

    • 添加js文件到页面 ::: @Scripts.Render("~/Scripts/captcha.js")
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多