Uncaught SyntaxError: Unexpected token < into DOCTYPE html PUBLIC
I am having a series of JavaScript problems and the only thing I notice in the console.log is:
Uncaught SyntaxError: Unexpected token <
Which leads me to:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
I can not see a syntax error here. Is there any syntax error in this line? How can I fix it?
The error message indicates a JavaScript syntax error.
The code you quoted is XHTML, which is not JavaScript. Trying to treat it as JavaScript (as you are doing) is doomed to failure.
This is probably caused by entering the wrong URL in a src
attribute.
With HTML 5 simply use <!DOCTYPE html>
and <script type="text/javascript" src="YourFileName.js"></script>
in the <head
> section.
And don't forget to replace your java file name(.js).
链接地址: http://www.djcxy.com/p/46004.html