help about unxpected ";"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My web form worked fine before. Today I found three buttons do not work,
including a close button with ID btnClose. I use
btnClose.Attributes.Add("onClick", "window.close()")

in codebehind in VB.

The IE error message on the bottom after page loading:
line: 165
Char:44
Error: unexpected ';'
code:0

I have check line 165 in HTML and VB. I can not find anything. VB is
compiled now. I do not know where the problem is.

David
 
this is purely a javascript error. once the page is open, goto "view
source" and look AROUND page 165...you can post some of the code too here
for more help
 
try

btnClose.Attributes.Add("onClick", "window.close();")

you need to keep in mind that sometimes asp.net will tack on additional
items to the onclick that you're not aware of....

thus you need to cleanly close your javascript commands.

if you get desperate.. add

<script language='javascript'>
and
</script>

before the window.close..but I don't think that is the issue.. I think its
the lack of a trailing ; on the end of your line
 
Sorry. The error message is: expected ';'

I copy the same code to my new web form. It works. but this doesn't.
Here is the HTML code in this line:
<asp:Button id="btnClose" style="Z-INDEX: 133; LEFT: 128px; POSITION:
absolute; TOP: 48px" runat="server"
Text="Close"></asp:Button>


Dabin
 
Sorry. The error message is: expected ';'

I copy the same code to my new web form. It works. but this doesn't.
Here is the HTML code in this line:
<asp:Button id="btnClose" style="Z-INDEX: 133; LEFT: 128px; POSITION:
absolute; TOP: 48px" runat="server"
Text="Close"></asp:Button>

actually line 165 means the 165th line of javascript, not in the HTML
source. Which is sometimes hard to find if your javascript is spread out
or when ASP.NET .js files get involved :)
 
Thank you. I did figure it out. It need ";" after function name. That is the
problem. But some are still working without ";".
That is funny. However, I have to change all of them.

David
 
as i said, it needs to be the RENDERED html.

Open the page in IE and look for or around the line.

you shouldn't be seeing <Asp:button but rather <input type="button"

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top