帮我生成一个html页面,页面元素有两个输入框,一个显示输入接收验证码的邮箱账号,一个显示输入验证码,两个按钮,一个获取验证码,一个登录,然后就是使用ajax向后端发送数据要求发送方式都是post,点击获取验证码后按钮变为不可使用并显示在60秒后重试,整个页面参考qq邮箱登录界面

时间: 2023-09-30 19:09:40 浏览: 45
好的,以下是一个简单的HTML页面,包含你所需要的所有元素和功能: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Email Verification Code</title> <style> body { background-color: #f5f5f5; font-family: 'Arial', sans-serif; } .container { margin: 50px auto; width: 450px; padding: 30px; background-color: #fff; border-radius: 10px; box-shadow: 0px 0px 10px #888; } h1 { text-align: center; margin-bottom: 30px; } input { display: block; width: 100%; margin-bottom: 20px; padding: 10px; font-size: 16px; border: none; border-radius: 5px; box-shadow: 0px 0px 5px #ccc; } .btn { display: inline-block; padding: 10px 20px; background-color: #007aff; color: #fff; font-size: 16px; border: none; border-radius: 5px; cursor: pointer; } .btn.disabled { background-color: #ccc; cursor: not-allowed; } .error { color: #ff0000; font-size: 14px; } </style> </head> <body> <div class="container"> <h1>Email Verification Code</h1> <form id="verification-form"> <label for="email">Email Address:</label> <input type="email" id="email" name="email" required> <label for="code">Verification Code:</label> <input type="text" id="code" name="code" required> <div id="error-message" class="error"></div> <button id="btn-get-code" class="btn">Get Verification Code</button> <button id="btn-login" class="btn disabled">Login</button> </form> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function() { var timer; var countdown = 60; var isSending = false; // Disable the login button by default $('#btn-login').attr('disabled', true); // Handle form submission $('#verification-form').submit(function(e) { e.preventDefault(); var email = $('#email').val(); var code = $('#code').val(); $.post('/verify', { email: email, code: code }, function(response) { if (response.success) { // Redirect to the dashboard page window.location.href = '/dashboard'; } else { // Display the error message $('#error-message').text(response.message); } }); }); // Handle the Get Verification Code button click $('#btn-get-code').click(function() { if (isSending) { return; } var email = $('#email').val(); $.post('/send-code', { email: email }, function(response) { if (response.success) { // Disable the button and start the countdown timer isSending = true; $('#btn-get-code').addClass('disabled'); timer = setInterval(function() { countdown--; if (countdown === 0) { clearInterval(timer); isSending = false; countdown = 60; $('#btn-get-code').removeClass('disabled'); $('#btn-get-code').text('Get Verification Code'); } else { $('#btn-get-code').text(countdown + ' seconds left'); } }, 1000); } else { // Display the error message $('#error-message').text(response.message); } }); }); // Handle input changes $('#email, #code').on('input', function() { var email = $('#email').val(); var code = $('#code').val(); if (email && code) { $('#btn-login').removeClass('disabled'); $('#btn-login').attr('disabled', false); } else { $('#btn-login').addClass('disabled'); $('#btn-login').attr('disabled', true); } }); }); </script> </body> </html> ``` 请注意,这只是一个示例页面,并不包含后端代码。你需要根据你的需求修改和添加必要的代码。此外,你还需要将 jQuery 库文件链接到你的页面中,以便使用 AJAX 功能。

相关推荐

最新推荐

recommend-type

vue实现一个6个输入框的验证码输入组件功能的实例代码

主要介绍了vue实现一个6个输入框的验证码输入组件功能,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
recommend-type

Flutter 完美的验证码输入框实现

主要介绍了Flutter 完美的验证码输入框实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
recommend-type

django之从html页面表单获取输入的数据实例

主要介绍了django之从html页面表单获取输入的数据实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
recommend-type

Python弹出输入框并获取输入值的实例

今天小编就为大家分享一篇Python弹出输入框并获取输入值的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
recommend-type

中文翻译Introduction to Linear Algebra, 5th Edition 2.1节

中文翻译Introduction to Linear Algebra, 5th Edition 2.1节 线性代数的核心问题是求解方程组。这些方程都是线性的,即未知数仅与数相乘——我们绝不会 遇见 x 乘以 y。我们的第一个线性方程组较小。接下来你来看看它引申出多远: 两个方程 两个未知数 x − 2y = 1 3x + 2y = 11 (1) 我们一次从一个行开始。第一个方程 x − 2y = 1 得出了 xy 平面的一条直线。由于点 x = 1, y = 0 解 出该方程,因此它在这条直线上。因为 3 − 2 = 1,所以点 x = 3, y = 1 也在这条直线上。若我们选择 x = 101,那我们求出 y = 50。 这条特定直线的斜率是 12,是因为当 x 变化 2 时 y 增加 1。斜率在微积分中很重要,然而这是线 性代数! 图 2.1 将展示第一条直线 x − 2y = 1。此“行图”中的第二条直线来自第二个方程 3x + 2y = 11。你 不能错过两条线的交点 x = 3, y = 1。点 (3, 1) 位于两条线上并且解出两个方程。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

识别MATLAB微分方程求解中的混沌行为:分析非线性方程混沌行为的实用技巧

![matlab求解微分方程](https://img-blog.csdnimg.cn/2021062810300367.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTQ3OTY3OA==,size_16,color_FFFFFF,t_70) # 1. MATLAB微分方程求解概述 微分方程是描述物理、工程和金融等领域中动态系统的数学模型。MATLAB提供了强大的工具来求解微分方程,包括内置求解器和自定义函数
recommend-type

physon如何做ERP系统

作为一个AI语言模型,我可以给您提供一些基本的建议和思路: 1.明确需求和目标:在开始开发ERP系统之前,需要明确您的业务需求和目标,了解您的业务流程、流程数据、员工角色和权限、财务管理等方面的要求,这样才能更好的设计和开发ERP系统。 2.选择技术框架和开发工具:选择合适的技术框架和开发工具是ERP系统开发的关键。选择一种流行的技术框架和工具可以提高开发效率和质量。 3.设计数据库:ERP系统需要一个功能强大的数据库来存储数据。设计数据库需要考虑数据的完整性、安全性和可扩展性。 4.设计系统架构:系统架构是ERP系统的骨架,需要考虑系统的可扩展性、可维护性和性能。 5.开发和测试:
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依