Quote characters in hyperlink

M

Mike P

How do I prevent this link with a single quote in from crashing?

<div id="Div10" class="otherLeftBarLink"
onclick="window.location.href('/ELearningSystem/payment
q's/CP_Course_SCORM_20080822/indexCourse161_489.htm')">
 
A

Anthony Jones

Mike P said:
How do I prevent this link with a single quote in from crashing?

<div id="Div10" class="otherLeftBarLink"
onclick="window.location.href('/ELearningSystem/payment
q's/CP_Course_SCORM_20080822/indexCourse161_489.htm')">

In JavaScript stirng literals as above you escape ' using \'

'/ELearningSystem/payment
q\'s/CP_Course_SCORM_20080822/indexCourse161_489.htm'

Will do it.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top