有没有办法在网站上禁用自动填充表单?

编程入门 行业动态 更新时间:2024-10-28 12:25:50
本文介绍了有没有办法在网站上禁用自动填充表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近才学会使用 HTML 和 PHP 来创建网站。

我创建了一个有测验的网站,要求人们随意翻译单词。用户将他们的答案输入到表单中,网站将答案评估为正确或不正确。

现在当一个问题在会话中被询问两次时,自动填充显示让人们看到他们以前的提交。然而,对于试图测试他们的记忆的人来说,这并不好。

我知道我可以在我的浏览器中关闭自动填充功能,但是有什么方法可以调整 PHP 或 HTML 代码,以便自动填充此特定表单时自动关闭?

解决方案

将它放在< form> 标记或每个< input> 标签是这样的:

< form autocomplete =off/> <! - 或 - > < input type =textautocomplete =offvalue =Text/>

I have only recently learned to create websites using HTML and PHP.

I have created a website that has a quiz where people are asked to translate words at random. The user inputs their answers into a form, and the website evaluates the answer as correct or incorrect.

Now when a question is asked twice in a session, auto-fill shows up, allowing people to see their previous submissions. However for people trying to test their memory this isn't good.

I know I can turn off auto-fill in my browser, but is there a way I can adjust the PHP or HTML code so that auto-fill is automatically turned off for this particular form?

解决方案

autocomplete="off" should do the trick!

Put this in your <form> tag or in every <input> tag like this:

<form autocomplete="off" /> <!-- OR --> <input type="text" autocomplete="off" value="Text" />

更多推荐

有没有办法在网站上禁用自动填充表单?

本文发布于:2023-11-03 14:23:56,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   表单   网站

发布评论

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

>www.elefans.com

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