tags:

views:

128

answers:

4

I copied this page's source in Aptana IDE for javascript. But, in the last lines:

                        <script language="JavaScript">
                            init();
                        </script>
                    </body>
                    </html>

it is showing at the init() line: syntax error, why? (when run, it works correctly)

+2  A: 

Change it to

<script type="text/javascript">
SLaks
this get rid of the warning at the <script> line, but not the error at the init() call line..
Tom Brito
+2  A: 

There's a missing semicolon. Change

<input type="reset" onclick="lines=0;return true">

to

<input type="reset" onclick="lines=0;return true;">
Jeff
A simple fix! Aptana seems to indicate the syntax error on the wrong line. Why is this?
Neville Flynn
Not sure. If I had to guess, it's because Aptana continues trying to evaluate the "return true ..." statement including the HTML tags and all since there's no semicolon to terminate the statement. By the time it gets to the other semicolon at `init();`, the statement isn't valid.
Jeff
I may award your bounty in 20 hours. Thanks!
Tom Brito
A: 

If you copy/pasted maybe the editor is with invalid characters, try checking for " or ' and replacing them with regular quotes and doboule quotes.

Copy Pasting source codes ofter cause this problem.

Angelus
+1  A: 

I cannot reproduce this. Copy/pasting the code from that page into Aptana does not give me any errors. Make sure that a) you have the latest version of Aptana, and b) there are not any strange cop/paste artifacts in your code. Try pasting to notepad first and then from there to Aptana, to remove formatting information and see if it make a difference.

alt text

Gabe Moothart
I see the error on init() line in Aptana Studio 2.0.4.1268158907.
Neville Flynn
I'm running 2.0.5.1278522500 in the screenshot.
Gabe Moothart