By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,567 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,567 IT Pros & Developers. It's quick & easy.

Problem with string and apostrophe

100+
P: 263
Hi all.

I have problem with this code javascript:

Expand|Select|Wrap|Line Numbers
  1. <input type="submit" name="Submit" value="Go" onclick="if(confirm('Confirm?')) location.href='page.asp?DES=Try after 1' minute'; return false;"></a> 
  2.  
If delete the apostrophe in the string "Try after 1' minute" the page working:

Expand|Select|Wrap|Line Numbers
  1. <input type="submit" name="Submit" value="Go" onclick="if(confirm('Confirm?')) location.href='page.asp?DES=Try after 1 minute'; return false;"></a> 
  2.  
Why? Any solution?
Can you help me ?

Thanks
viki
Jul 11 '08 #1
Share this Question
Share on Google+
4 Replies


acoder
Expert Mod 15k+
P: 16,027
Escape the single quote:
Expand|Select|Wrap|Line Numbers
  1. <input type="submit" name="Submit" value="Go" onclick="if(confirm('Confirm?')) location.href='page.asp?DES=Try after 1\' minute'; return false;"></a> 
  2.  
Jul 11 '08 #2

100+
P: 263
OK, thanks Acoder !!!!!
Jul 12 '08 #3

acoder
Expert Mod 15k+
P: 16,027
You're welcome. Glad to help.
Jul 12 '08 #4

acoder
Expert Mod 15k+
P: 16,027
Hmm, just noticed the closing anchor tag - not sure what that's doing there. Make sure your HTML is valid.
Jul 12 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.