Mozilla VPN is currently experiencing an outage. Our team is actively working to resolve the issue. Please check the status page for real-time updates. Thank you for your patience.

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

cannot get a javasript alert to work in FF, but the same alert works in IE, Chrome, Opera.

  • 4 个回答
  • 1 人有此问题
  • 31 次查看
  • 最后回复者为 Yiki

more options

Just trying to get the below alert message to display in FF, but it won't. It works in other browsers. I checked the settngs in Options/Content and Javascript is on. This could be obvious but I can't see anything.

alert("Example message!");

Just trying to get the below alert message to display in FF, but it won't. It works in other browsers. I checked the settngs in Options/Content and Javascript is on. This could be obvious but I can't see anything. alert("Example message!");

被采纳的解决方案

Try "text/javascript" for your type attribute. Firefox does not run jscript.

定位到答案原位置 👍 0

所有回复 (4)

more options

How and where are you trying to run that JavaScript code?

You can no longer run JavaScript code via the location bar in Firefox 6 and later.
You can use the Scratch pad (Firefox > Web Developer > Scratchpad; Shift+F4) to run JavaScript code.

more options

It references a javascript file from the head tag. See code sample below. It works in other browsers without any problems.

<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Example</title>
<script type="text/jscript" src="example.js"></script>

</head>

And this is the code in the javascript file: alert("Example message!");

more options

选择的解决方案

Try "text/javascript" for your type attribute. Firefox does not run jscript.

more options

Thanks, knorretje. That worked.