Log in

View Full Version : expected ';' error?



voobass
11-25-2006, 05:45 AM
What does the error
Line 136, Character 50, expected ';'
mean?

This is line 136:

leftrightslide[0]='<a href="javascript:ajaxpage('links.htm', 'contentarea');"><img src="itemp/sp-airborne.gif" border=0

Your help is appreciated!

djr33
11-25-2006, 05:50 AM
Well, looks to me like you're probably missing a semicolon at the end of the line.
However, it seems more like an error with quotes...


leftrightslide[0]='<a href="javascript:ajaxpage('links.htm', 'contentarea');"><img src="itemp/sp-airborne.gif" border=0...///finishline///....';

voobass
11-25-2006, 06:02 AM
Well, looks to me like you're probably missing a semicolon at the end of the line.
However, it seems more like an error with quotes...


leftrightslide[0]='<a href="javascript:ajaxpage('links.htm', 'contentarea');"><img src="itemp/sp-airborne.gif" border=0...///finishline///....';

Thanks for the reply! I tried putting a semicolon at the end of the line (no change) and then putting a semicolon at at various places. The error message changed when I eventually enclosed links.htm in semicolons. But then it said error, links.htm undefined.

There's got to be a way to make leftrightslide[0]='<a href="javascript:ajaxpage('links.htm','contentarea');"> act like leftrightslide[0]='<a href="mypage.htm">

tech_support
11-25-2006, 06:15 AM
leftrightslide[0]='<a href="javascript:ajaxpage(/'links.htm/',/'contentarea'/);">'

voobass
11-25-2006, 06:25 AM
leftrightslide[0]='<a href="javascript:ajaxpage(/'links.htm/',/'contentarea'/);">'

Thanks, too. Unfortunately, that generated the same error. I tried using (/'links.htm'/ too but that made no difference.

ItsMeOnly
11-25-2006, 08:47 AM
because that should be backslashes: \'

voobass
11-25-2006, 04:24 PM
I got it to work with some help from madlemming at Tech Report:


leftrightslide[0]='a href=\"javascript:ajaxpage(\'contact.htm\', \'contentarea\');\">';

Thanks for everyone's help!

djr33
11-25-2006, 07:26 PM
1. Each line must end with a semicolon.
2. Quotes come in pairs, enclosing things.
You cannot, for example, have:
'<a href="image.jpg">;
since you need to END the first single quote.
3. Neither quotes nor semicolons are to be placed randomly... they each have a specific purpose. Placing them in the wrong spot or in the wrong way will create an error. By doing what you said, placing it in the middle of the line, you CAN suppress the error by giving it a semicolon, but that will just create more problems because that semicolon does NOT belong there.

Basically.... semicolons only and always at the end of lines; quotes in pairs, always be sure they are.

I think the confusion here is that you were using javascript to write html that included javascript commands, thereby giving yourself several layers of quotes to deal with.

Glad it works.

voobass
11-25-2006, 08:42 PM
Thanks for the the rules. They will come in handy for future problems.