Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expected ')' runtime error on window.alert 1

Status
Not open for further replies.

wendas

MIS
Apr 20, 2001
92
US
I will admit I know little about java script. I copied this off a web site, then when it didn't work looked for another example, it set up slightly different but had the same error. Another puzzler is although it does not work when showing a message from a field, it works with a hardcoded string line.. So it is either due to the field or the info in the field.. But I see no extra "(" that need a closing ")"


The code not working that passes a field.
Code:
 lbl.Text = "<script language='javascript'>" & Environment.NewLine _
& "window.alert(" & "'" & exp.Message & "'" & ")</script>"
The translated code when looking at it in debug.
Code:
<span><script language='javascript'>
window.alert('Could not find a part of the path 'G:\Reports\testrpt\2008-Oct\TearSheet10242008.pdf'.')</script></span>
A similar WORKING example, but the message is not a field.
Code:
lbl.Text = "<script language='javascript'>" & Environment.NewLine _
& "window.alert(" & "'" & "Error reading Acrobat PDF. (Did you change your version of Acrobat reader?) Call programmers to fix." & "'" & ")</script>"


(PS.. I have figured out the reason for the error.. I can not use mapped paths.. I am just still forcing the error to fix the error handler)
 
You need to either escape your single quotes, or use double quotes as your string delimiters. The issue is your apostrophe is closing the string.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Thanks, I knew I was spending HOURS bashing my head against a wall with something someone could easily tell me what it was.

I did a replace and replaced the ' in the code with a space. I now get the message, although it looks like the backslashes are being translated into something quirky.. I will need to find a way to replace the / for something that will be reinterpreted as a /.. If you have an answer that would be helpful, otherwise I am back to surfing the internet for an answer.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top