如何使用下拉菜单创建Java脚本提示 [英] How to create java script prompt with dropdown
问题描述
我是网络技术编码的新手.令我惊讶的是,我们只能在文本中提示.我的要求是使用选项(下拉)列表具有提示,该列表将在PHP中的某些全局变量中存储该选择.
真的不知道该怎么做吗?尝试过jQuery等,但没有相关信息.
谢谢.
您可以使用.
I am new to coding in web technology. To my surprise got to know that we can have prompt only with text. My requirement is to have prompt with options(dropdown) list which when selected will store that selection in some global variable in PHP.
Really don't have idea on how to? Tried jquery etc but no relevant info.
Thanks in advance.
Instead of a standard JavaScript prompt, you can use something like Modals from Bootstrap or Dialogs from jQuery UI.
See this demo for some idea on how those modals can look like and behave.
This is how you define the modals - example from the Bootstrap page:
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
It results in something like this:
You can add any HTML inside, including dropdown menus.
这篇关于如何使用下拉菜单创建Java脚本提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!