我想在JavaScript弹出框中找到一个下拉列表。
function Start() {
var name = prompt("Hello, What is your name?")
if (isNaN(name)) {
confirm("Hello " + name + "!")
var race = prompt("What race are you? (First letter Uppercase please)")
if (race == "Human") {
confirm("You are a noble race that will protect his family and children when in harms way.")
var startTown = prompt("What is your city?")
} else if (race == "Orc") {
confirm("Hello Orc. Your murderous journey begins!")
} else {}
}
}
编辑:我正在尝试获取var startTown()函数的下拉列表。我想在JavaScript弹出窗口的下拉框中获取自定义命名城市的列表
答案 0 :(得分:1)
prompt()
组件只能接受文本输入。您不能拥有预先填充的列表或其他内容。如果您需要这样的东西,可以使用许多jQuery模态窗口,我建议使用Queness的基本Simple jQuery Modal Window或jQuery UI's dialog并在页面中添加<select>
标记