将select元素放在javascript提示中? [英] Put select element in a javascript prompt?
问题描述
我想弹出一个JavaScript提示,其中包含选择元素而不是文本输入.在寻找解决方案时,似乎可以肯定使用jquery,但是我对HTML和javascript并不陌生,并且jquery弹出窗口的教程令人生畏(我不知道如何实现它们)!是否可以仅使用javascript创建这样的弹出窗口?我希望这样的事情是可能的:
I would like to have a javascript prompt pop up that has a selection element in it rather than a text input. When searching for a solution it seems that using jquery could definitely work but I am new to HTML and javascript and the tutorials for a jquery popup are daunting (I cannot figure out how to implement them)! Is it possible to create such a pop up with just javascript? I was hoping something like this would be possible:
prompt(<select>[options...]</select>);
提前谢谢!
推荐答案
What you're looking for is called a modal dialog. This is really just a DIV with HTML inside it, with an overlay over the rest of the page.
您可以自己动手或使用图书馆中的现成商品.
You can roll-your-own or use a ready-made one from a library.
这篇关于将select元素放在javascript提示中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!