View Full Version : How do I format text returned by a function?

03-14-2005, 07:08 PM
This is probably a very silly question but I can't find any reference to this in the online JS tutorials or the archives, so I hope someone can help. I would like to add some formatting to the captions returned by

onclick="changeimage(photos[1], this.href, 'caption')"

in the slide show I'm creating. I've created overall parameters for the output in CSS, but I'd like to have a mixture of bold and normal weight text and some line breaks *within* the caption text. I tried this using the standard html delimiters and it worked like a charm in all of IE6, Firefox, IEMac, Safari and Netscape 7, but the W3C XHTML 1.0 transitional validator says no! no! no! naughty! I tried using &lt; and &gt; instead of < and >, but the validator doesn't seem to recognise the difference.

Is there an accepted way of doing this so I can get my page to validate?

The validator also doesn't like the second semicolon in the second line of

function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
photos[i]=new Image()

Is there a way round this one too?