Click to See Complete Forum and Search --> : Unexplained Javascript Error


apatel
12-02-2002, 10:58 AM
Hey everyone,

I am new to the group, but wondered if anyone could help me with this javascript problem I am having (and cannot seem to get rid of). Here is my code that is giving me the problem:

<script type="text/javascript">
<!--
createTree(Tree,1); // start the tree at node nr. 1
-->
</script>

The error I get in IE 6, is "Error: Expected ';' ". The line it gives me for the error is the last line (the one with "</script>"). Funny thing is, I do not get this error in Netscape 7 when I try it.

Any ideas?

-AP

AdamGundry
12-02-2002, 11:31 AM
You have commented out the Javascript code for non-capable browsers (using <!-- -->). However, I believe you are having the problem because the HTML end comment --> is part of the code, when it is not a valid Javascript instruction. Try commenting the line containing the --> out (using //). I.e:

<script type="text/javascript"><!--
createTree(Tree,1); // start the tree at node nr. 1
// -->
</script>

Hope this helps

Adam

apatel
12-02-2002, 12:06 PM
I tried to comment out the" --> " line and I still get the same error. I am working with IE6 here, which I don't believe is a non-capable browser. Additionally, I know that the Javscript code is being executed, because the tree that is created shows up on the page on preview. Any other ideas?

-AP