Reputation: 131
I have issue in firefox 22 and IE (basic from win7) finds invalid character error in trivial for loops. Code works fine in Opera. Here is the trivial testcase:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
...
<body>
<script language="javascript" type="text/javascript">
for(var i = 0; i < 3; i++) {
alert("ccc");
}//INVALID CHARACTER IN THIS LINE
</script>
...
Upvotes: 0
Views: 465
Reputation: 887
If you paste you code into jsbeautifier.org you will see your problem right away. It is maked in red.
Upvotes: 0
Reputation: 303421
You have one or more bad whitespace characters in your source code, likely the result of copy/pasting from a web page. Re-type the content in a new file by hand, and watch the problem disappear.
Alternatively, delete every space/tab and return character from the file and re-type them.
In this case, the bad character comes before the }
on the line you indicate. Place the cursor before that character and press delete/backspace and notice that nothing seems to happen. You have just deleted the bad character.
(Want proof? Copy/paste the content of the script block above into http://jsfiddle.net and notice the bright red bullet that appears.)
Upvotes: 3