【发布时间】:2012-03-07 08:55:24
【问题描述】:
所以,我有代码,它还没有完成,但我想要它做的只是在我写下“帮助”这个词时显示一个警告框,如果输入了其他任何内容,则说其他内容。
function prompter() {
var reply = prompt("This script is made to help you learn about new bands, to view more info, type help, otherwise, just click OK")
if (reply === 'help' || 'Help')
{
alert("This script helps you find new bands. It was originally written in Python 3.0.1, using Komodo IDE, but was then manually translated into Javascript. Please answer the questions honestly. If you have no opinion on a question, merely press OK without typing anything.")
}
else
{
alert("Press OK to continue")
}
};
但是,无论如何,第一个警告框会弹出,即使您按下取消! 我该如何解决这个问题???
【问题讨论】:
标签: javascript if-statement prompt