Pages: 1
Print
Author Topic: How to insert an ampersand (&) in a file to be used as a footer for webhelp  (Read 806 times)
pebraham
Member

Posts: 16


« on: March 01, 2011, 07:45:18 AM »

Hi

If the footer file I use when generating webhelp includes an '&' character, the file is not included by the Webhelp generator.

For example if the following line of script is in the footer file, that file does not get included:

function mail(){parent.location = 'mailto:xx@yyy.com?Subject=Feedback &body= some text'
;}


Remove the '&' and it does get included, but of course the mailto line is not now what I want.

I have tried replacing the & with %26, but the replacement of %26 by '&' comes in too late and  the '&' becomes just another part of the mail subject.

How should I specify the ampersand in the footer file?

Best regards,|
Pete
Logged
pebraham
Member

Posts: 16


« Reply #1 on: March 02, 2011, 08:38:33 AM »

For those who had the same problem: surround the javascript code with <![CDATA[ and ]]>, like so:

<script>
<![CDATA[
  javacode including characters like & < >
]]>
</script>

or even:

<script>
/* <![CDATA[ */
  javacode including characters like & < >
/* ]]> */
</script>


Logged
Su-Laine Yeo
Solutions Consultant
Member

Posts: 260


« Reply #2 on: March 04, 2011, 12:43:09 PM »

Ah, that's a useful idea. Thanks for sharing it!

Su-Laine
Logged

Su-Laine Yeo
Solutions Consultant
JustSystems Canada, Inc.
Pages: 1
Print
Jump to: