|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am putting an inline javascript tag to open a new window when pressing an asp:button control. I got this from another forum (they want to charge to post). Here is the code:
code ------------------------------------------------------------------------ response.write("<script language='JavaScript'>window.open('sources.asp','PopUp','location=no,too lbar=no,status=no,menubar=no,scrollbars=yes,resiza ble=yes')</script>") ------------------------------------------------------------------------ I am getting the "string constant must end with a double quote" compliter error on the last ")" before the </script> tag. On further digging the actual error is: Statement cannot appear within a method body. End of method assumed Talking about the ")". For some reason it is trying to end the command prior to the </script> tag instead of after it. Any ideas? Thanks |
|
#2
|
|||
|
|||
|
Try Following:
<a href="javascript:window.open('source.asp','Reference','r esizable=yes, toolbar=no,location=no,directories=no, status=no, menubar=no, scrollbars=yes,width=600,height=400');void('');">Click here for reference</a> |
|
#3
|
|||
|
|||
|
double quote probelm
Well, I don't thing that using the <a href> tag will work. I need to open the page from a button click event, not a link on the page. It needs to do some other processing before opening the page.
Thanks |
|
#4
|
|||
|
|||
|
I just copied your code and ran it without any problem...
|
|
#5
|
|||
|
|||
|
double quote problem
Now that is really strange. the code is a direct copy and paste from my code.
Did it run in a browser and open a new window? Brett |
|
#6
|
|||
|
|||
|
double quote
numbernine - what version of the .net framwork are you running? Mine is 1.1
|
|
#7
|
|||
|
|||
|
I'm using version 1.0.3705.288
|
|
#8
|
||||
|
||||
|
Maybe it's choking on the parentheses? Try escaping the js parentheses using \ and see if that'll serve as a workaround. Just a shot in the dark...
|
|
#9
|
|||
|
|||
|
Try this instead:
response.write("<script language='JavaScript'>window.open('sources. asp','PopUp','location=no,toolbar=no,status=no,men ubar=no,scrollbars=yes,resizable=yes')<" & "/script>") I guess there's a bug in the in-line parser that thinks the </script> tag in a string is actually the end of the script. Just break up the string to have it work. Obviously you can make the above line more efficient w/ a String.Format or String.Concat, but that's the jist of it. Hope this helps. Mike |
|
#10
|
|||
|
|||
|
parsing
Thanks!!!!
|
|
#11
|
|||
|
|||
|
I had the same problem. Thanks, mikejoseph, it worked like a charm.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > asp.net -String constants must end with a double quote - problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|