【发布时间】:2013-03-23 19:28:27
【问题描述】:
浏览器显示“thinksHarry Potter”,“thinks”和“harry”两个词之间没有空格,所以我的伙计们能告诉我该怎么做吗?这是我的代码:
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
alert("thinks" + person);
}
}
</script>
</body>
</html>
【问题讨论】:
-
alert('thinks ' + person); -
这一定是个结局。
标签: javascript alert prompt