Quote characters in hyperlink

  • Thread starter Thread starter Mike P
  • Start date Start date
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')">
 
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.
 
Back
Top