纯 JavaScript/jQuery/HTML 验证码
有人可以给我发一个链接,或者给我提供一个纯 Javascript/jQuery 验证码的示例吗?因为我可以看到很多 PHP/C# 后端的示例。但我只需要 Javascript 。
谢谢 !!
can somebody sent me a link, or to provide me an example with pure Javascript/jQuery captcha. Because I can see a lots of examples with PHP/C# ... back end. But I need just Javascript .
Thanks !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
查看:
http://www.google.com/recaptcha/intro/
此处演示:
http://www.google.com/recaptcha/api2/demo
或者
http://www.finalwebsites.com/demos/custom-captcha-image-脚本/
=============================简而言之=============== =====
将代码片段添加到页面以使验证码发生:
每当用户完成挑战时,就会填充一个名为 g-recaptcha-response 的文本区域,其中包含值,您将收集该值并发送以下请求以验证它:
https://www.google.com/recaptcha /api/siteverify?secret=YOUR_KEY_2&response=TOKEN&remoteip=IPADDRESS
使用js获取IP可能比较麻烦:
http://www.ipify.org/
Check out:
http://www.google.com/recaptcha/intro/
Demo here:
http://www.google.com/recaptcha/api2/demo
OR
http://www.finalwebsites.com/demos/custom-captcha-image-script/
===========================IN SHORT====================
Add the code snippet to the page for the captcha to occur:
whenever user complete the challenge, a textArea named g-recaptcha-response with value is populated, you will collect that value and send below request to validate it:
https://www.google.com/recaptcha/api/siteverify?secret=YOUR_KEY_2&response=TOKEN&remoteip=IPADDRESS
Getting the IP using js may be troublesome:
http://www.ipify.org/
我现在正在研究替代验证码。如果您只使用它的客户端部分,假设您只想在浏览器中显示某些内容,那么您将拥有您想要的内容。它不完全是纯 javascript,因为它仍然使用 api 来获取图片,并且看起来足够酷:D
http://photocaptcha.cu .cc
这将涉及在您这边包含一个脚本,但如果您不验证答案,则没有多大意义;)
I'm working on an alternative captcha right now. If you'll use only client-side part of it, you'll have what you want assuming you want something just to show in the browser. It's not exactly pure javascript, since it still uses api to get a picture, and looks cool enough :D
http://photocaptcha.cu.cc
It would involve including one script on your side, but it doesn't make much much sense if you don't validate the answers ;)
这里有一个关于带有验证码的 jQuery 教程; http://www.tutorialcadet.com/jquery-advanced-ajax-验证码验证/
There is a tutorial on jQuery with captcha located here; http://www.tutorialcadet.com/jquery-advanced-ajax-validation-with-captcha/
你好,AlexC,你可以在客户端验证你的谷歌验证码 100%工作对我来说验证你的谷歌验证码只需看下面的代码
这段代码位于 html 正文中:
这段代码放在调用 get_action(this) 方法表单按钮的 head 部分:
Hi AlexC you can validate your google recaptcha at client side also 100% work for me to verify your google recaptcha just see below code
This code at the html body:
This code put at head section on call get_action(this) method form button:
我写了一篇关于使用 PHP 和 jQuery 制作简单数学验证码的教程,因此无论启用或不启用 Javascript 都可以使用。这应该很容易集成到您自己的脚本中,或者您可以按原样使用它。您可以下载该项目,解压 zip 文件,然后它就可以开箱即用。我希望你觉得这很有用。
使用 jQuery 和 PHP 制作简单的数学验证码
http://www.sinawiwebdesign.com/博客/主题/编程/jquery-and-php-and-catcha-tutorial/
I wrote a tutorial on making a simple math captcha using PHP and jQuery, so it works with or without Javascript enabled. This should be very easy to integrate into your own scripts, or you can use it as is. You can download the project, extract the zip file, and it works out of the box. I hope you find this useful.
Making a Simple Math Captcha using both jQuery and PHP
http://www.sinawiwebdesign.com/blog/topics/programming/jquery-and-php-and-catcha-tutorial/
您是否只是因为听起来很怪异就想添加验证码?
除非确实需要,否则不要使用它。
Do you want to add CAPTCHA just because it sounds geeky?
Don't use it unless it is really needed.
我认为这不是一个好主意,因为如果在客户端(js)中进行验证,有人可以编写脚本来读取正确的答案。
编辑
无论如何,如果你想要一个无用的验证码,你可以使用这个:
参见jsfiddle。
HTML
JS
编辑2:
我的“验证码”黑客:
参见jsfiddle.
I think this is not a good idea, because if validation is made in client (js), somebody can make a script to read the correct answer.
EDIT
Anyway, if you want a useless captcha, you can play with this:
See in jsfiddle.
HTML
JS
EDIT 2:
My "captcha" hack:
See in jsfiddle.
这没有道理……如果没有后端检查,验证码就没用了。无论如何,机器人不使用 JavaScript。你要做的就是惹恼你的用户。
That doesn't make sense... without a backend check, the captcha is useless. bots don't use javascript anyway. All you'd be accomplishing is to annoy your users.