views:

100

answers:

4

test.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
      xml:lang="en">
  <head><title>Test</title></head>
  <body>
    <script language="javascript" type="text/javascript" src="test.js"></script>
  </body>
</html>

test.js:

var a = 4;

Firebug:

syntax error
var a = 4;
 ^

Anyone?

+2  A: 

Your file probably has some hidden character which is causing the problem. Create a new file and try again.

Soufiane Hassou
A: 

I've seen that kind of error show up when the DTD is incorrect, or the page doesn't quite validate with that DTD. It's totally unintuitive, but try it out.

Elocution Safari
A: 

Some encoding problem? UTF with BOM? Create a new plain txt file and rename it to test.js and write(!) in the code again.

powtac
+1  A: 

Remove the language="javascript" it is not XHTML valid!

Add also a character encoding meta tag.

<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
powtac
The language="javascript" was doing it. Thanks.
Daniel Straight
Check the validator from W3C.
powtac