Hi all. This isn't quite the same single/double-quote problem we see
posted a multitude of times in this ng. Read on...

I have a js function called ShowActiveLink which accepts a string
containing the full "<a href...>" element. My problem is that some of
the hrefs contain both single and double quotes and I don't have the
ability to escape these characters manually because our content
management system inserts the href when it generates the site.
Therefore I end up with code like this:

<script language="javascript">
void ShowActiveLink('<a
href="javascript:newWindow('http://www.vre.org/');">VRE Service
Status</a>');
</script>
<a href="javascript:newWindow('http://www.vre.org/');">VRE Service
Status</a></li>

....which causes a compiler error.

(Incidentally, the function searches for the current page name inside
the provided href string. If it's found it displays a <li
style="list-style-image: url('images/arrow-right.gif');"> before the
link. Otherwise, it displays an <li> without a bullet.)

Do any of you know a function or something that I can wrap around this
href to escape the string, regardless of how many single or
double-quotes there are, before it is passed to the function?

Thanks,
--Diarmaid.