3

我正在尝试在 Firefox 13.0.1 中测试以下代码,但它无法正常工作:

<!DOCTYPE html>
<html>
    <head>
        <title>Exercise 1</title>
        <script type="text/javascript" async src="example1.js"></script>
        <script type="text/javascript" async src="example4.js"></script>
        <script type="text/javascript" src="example3.js"></script>
    </head>
    <body>
        <p>Hello world</p>
    </body>
</html>

//example1.js:

alert("I'm the example 1");

//example3.js

alert("I'm the example 3");

//example4.js

alert("I'm the example 4");

当我打开包含上述 html 代码的文件时,会发生以下情况:

我编辑我遵循的流程

  1. 首先,脚本“example3.js”被执行,然后出现一个带有文本“I'm the example 3”的弹出窗口。之后,我在弹出窗口中单击“确定”按钮。
  2. 其次,执行脚本“example4.js”,然后出现一个带有文本“I'm the example 4”的弹出窗口。之后,我在弹出窗口中单击“确定”按钮。
  3. 第三,执行脚本“example1.js”,然后出现一个带有文本“I'm the example 1”的弹出窗口。之后,我在弹出窗口中单击“确定”按钮。
  4. 最后,应该显示正文内容(带有文本“Hello World”的段落),但它不在 Firefox 中,而是在 Chrome 中。在 Firefox 中,页面加载不会停止。

如果我在执行最后一个脚本后在 Firefox 中打开 Firebug,我意识到浏览器没有接收到 body 元素。

在此处输入图像描述

我不知道我的代码是正确的还是来自 Firefox 的错误。

谢谢你。

4

1 回答 1

2

这是 Firefox 中已报告的错误:https ://bugzilla.mozilla.org/show_bug.cgi?id=692754

于 2012-07-30T20:20:23.613 回答