【发布时间】:2016-12-21 23:38:49
【问题描述】:
例如:
<!doctype html>
<html>
<head>
<title>Example of confirm()</title>
<script>
if (confirm("Want to go to Disneyland?"))
document.location.href
=“http://park.hongkongdisneyland.com”;
</script> //says this wont work, because of the /<
</head> //says this wont work, because of the /<
</html> //says this wont work, because of the /<
VM43:1 Uncaught SyntaxError: Unexpected token
【问题讨论】:
-
该代码是正确的。可能错误在其他地方。
-
这个问题很难解释,但我假设您的 HTML 无效。如果您需要任何有用的反馈,请发布您的 HTML 代码。
-
还要使用“代码块”来发布代码,否则它真的不可读。
-
尝试使用正则引号而不是弯引号。
-
你的报价被抬高了。使用
",而不是“和”。
标签: javascript html