0

我有一个非常基本的 html 文档,如下所示:

<html>
<head>
<title>A Basic Javascript Game</title>
</head>
<body>
<script language="JavaScript" src="mygame.js">
</script>
</body>
</html>

我已经创建了一个相应的 Javascript 文件,并确保它的语法是正确的。mygame.js 文件的第一行是:

var persontotalkto = prompt("You wake up one Saturday morning. The Holidays just started, and you can't wait to tell your family where you've decided for all of us to go on vacation! Who do you talk to: WIFE, SON, or DAUGHTER?").toUpperCase();

但是当我打开 html 文件时,我没有得到任何提示。我启用了javascript,那么问题出在哪里?

4

2 回答 2

0

Change the script tag to either the HTML4 version:

<script type="text/javascript" src="mygame.js"></script>

Or the HTML5

<script src="mygame.js"></script>

(Either will work on any browser released this millennium.)

于 2013-08-23T18:28:26.267 回答
0

Change

<script language="JavaScript" src="mygame.js">
</script>

to

<script type="text/javascript" src="mygame.js">
</script>
于 2013-08-23T18:29:17.920 回答