可以仅使用HTML / CSS进行测验吗?(Possible to make a Quiz with HTML/CSS only? [closed])

系统教程 行业动态 更新时间:2024-06-14 17:04:03
可以仅使用HTML / CSS进行测验吗?(Possible to make a Quiz with HTML/CSS only? [closed])

我目前正在学习数学并思考一个想法,这取决于它是否可行。 我想添加100个数学方程,但是只有一个问题应该一次显示,直到你输入正确的答案然后点击下一个。

这只能用HTML吗?还是我需要其他语言? 我将在本地运行它,因此隐藏源代码中的答案并不重要。

I am currently studying math and thought of an idea, depending on if it is possible. I want to add in let say 100 math equations, but only one question should be displayed at once until you type in the correct answer and click next.

Is this possible with HTML only or would I need other languages? I will be running it locally so hiding answers in source code is not important.

最满意答案

据我所知,仅使用HTML是不可能的。 理想情况下,您需要一个数据库,用于存储问题,用户,以前的答案,答案的正确性以及整体性能。 您需要使用服务器端语言创建注册/登录屏幕。 在服务器上,您需要两个与问题功能密切相关的核心功能。 第一个是随机化一个尚未被问到的问题,另一个是处理用户的答案。 用户将加载页面,问题随机化器将在服务器上运行,每当用户回答问题时,客户端应向服务器发送POST请求,并回答问题并处理服务器的响应(显示下一个随机问题)。

但是,在实现数据库之前,您可能需要一个非常快速的解决方案。 在这种情况下,您可以将问题存储在Javascript数组中,在页面加载时随机化问题,将其显示给用户,当用户回答问题时,存储答案,显示是否正确,将问题添加到另一个存储的数组中回答问题并从问题数组中删除该项目,然后再次随机化并再次显示。 这不是一个理想的解决方案,但可以是一个临时的快速解决方案,在您启动更长的解决方案之前取得一些成功。

This is not possible using HTML only as far as I know. Ideally you need a database where you store your questions, your users, their previous answers, the correctness of the answers and their overall performance. You would need to create a register/login screen using a server-side language. On the server you would need two core functionalities closely related to the question feature. The first is to randomize a question which was not asked yet, the other is to handle the answer of the user. A user would load the page, the question randomizer would run on the server and whenever the user answers a question, your client-side should send a POST request to the server with the answer to the question and handle the response of the server (display the next randomized question).

However, you might want a very quick solution before you implement the database. In that case you could store the questions in a Javascript array, on page load randomize the question, display it to the user and when the user answers the question, store the answer, display whether it was correct, add the question to another array storing answered questions and remove the item from the question array, then randomize again and display again. This is not an ideal solution, but can be a temporary quick solution to have some success before you start the longer solution.

更多推荐

本文发布于:2023-04-24 21:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/a2e13732ef49b3d049364e5679b09588.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测验   CSS   HTML   Quiz   closed

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!