Pranav Kumar
Pranav Kumar

Reputation: 104

JavaScript working in Chrome but not in Firefox

I have a simple test page which seems to be working in Chrome but Not in Firefox.

The HTML Code is:

<html>
   <head>
      <title>Test Title</title>
   </head>

   <body>
      <script scr="test.js"> </script>

      <h1> Test </h1>
   </body>
</html>

The JavaScript code is:

alert("Hello World");
alert("Hello World");  
alert("Hello World");

Thanks in advance,

Upvotes: 1

Views: 359

Answers (1)

Mr.Moe
Mr.Moe

Reputation: 507

First of all your script elements source property got a typo and I would always use the MIME-Type info. try:

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

Furthermore, script definitions aswell as css links etc. should normaly be placed in the <head> section of your html document, not in the <body>

EDIT:

Actually the script MIME-Type is kinda deprecated and is not needed anymore. However, it does no harm if left in there.

Upvotes: 3

Related Questions