我刚开始学习JS,并且(当然)遇到了一些困难。我通常会很快掌握一些事情,但我不能为我的生活找到解决方案。我想知道为什么会这样。
我的目标是使用3个提示框,一个接一个地打印出来,打印出一段html代码,这将是一个简单的URL。我会添加更多内容,但我想首先考虑这个问题。
目前,我正在收到提示,但在我将数据输入第三个框并提交后,没有任何反应。
我在这做错了什么?如果我的document.write代码出错,我应该注意哪些事情?
谢谢!..
function show_prompt()
{
var site_type = prompt("What kind of link is this?");
var site_url = prompt("What is the URL?");
var site_title = prompt("Give the link a title");
if (site_type = website) {
document.write("site_title");
}
else
if (site_type = video) {
document.write("site_title");
}
else
if (site_type = image) {
document.write("site_title");
}
else
(site_type = article); {
document.write("site_title");
}
}