HTML输入自动完成/建议

编程入门 行业动态 更新时间:2024-10-12 03:18:10
本文介绍了HTML输入自动完成/建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何进行输入,以便用户单击时显示输入可以使用的所有可能值?我可以使用php从数据库中获取值,但是要显示如下图所示的图像,我想我必须使用javascript?我该怎么办?

How can make an input so that when the user click on it, it display all the possible values that the input can take? I can get the values from my database using php, but to display something like the image below, I guess I will have to use javascript? How can I do it?

例如,在phpPgAdmin中:

For example, in phpPgAdmin:

推荐答案

HTML中的select标记如何?它会创建一个下拉菜单,其中包含可从php脚本(从数据库获取)中加载的选项. W3Schools的一个示例在这里:

How about the select tag in HTML? It creates a drop-down menu with options that you can load from your php script (which fetches from the database). An example from W3Schools is here:

<select> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select>

更多推荐

HTML输入自动完成/建议

本文发布于:2023-08-03 06:27:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1284826.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自动完成   建议   HTML

发布评论

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

>www.elefans.com

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