-1

test.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<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;
 ^
6
  • Worked fine for me (FF 3.5.5, FB 1.4.5). Maybe move the script part to the head? Other plug-ins conflicting? Commented Nov 11, 2009 at 4:46
  • I am not getting any script error from your code. Commented Nov 11, 2009 at 4:47
  • That's the entire source. Be sure Firebug is active for scripts before refreshing and checking the error console. Commented Nov 11, 2009 at 5:36
  • Done and done. No errors logged. Commented Nov 11, 2009 at 6:05
  • What OS are you using? (I'm using Win 7.) Commented Nov 11, 2009 at 6:20

4 Answers 4

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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" />

2 Comments

The language="javascript" was doing it. Thanks.
Check the validator from W3C.
0

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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.