Click to See Complete Forum and Search --> : formatting array output


user12345678910
03-24-2003, 07:50 PM
Hi there --

I'm working with a JS array in an include that I didn't build... and will confess to being not-so-good with JavaScript. I need my error messages to be formatting prettily: using HTML code to add paragraphs, links, tables... so on and so forth.

I could, instead, redirect to a new page -- but I need to be able to provide more than a text-only string. However that function occurs is fine with me.

I can't seem to get the syntax right, and I know this isn't right: can anyone help?

For example...

var errormessage = new Array(
'<p>This is error one.</p>',
'<p>This is error two <a href="link.asp">with a link</a>.</p>',

I'll be so grateful for advice!

user12345678910
03-24-2003, 08:03 PM
Really? I get an error, and I assumed it was my error strings that caused it. I'm gonna have to take another look!

If I replace < with &lt; and > with &gt;, should I also replace " or ' in URLs with something?

For example:

<p><a href="link.asp">link</a></p>
should be
&lt;p&gt;&lt;a href="link.asp"&gt;link&lt;/a&gt;&lt;/p&gt;

?

I'm so grateful for the help...!

user12345678910
03-24-2003, 08:09 PM
Oh, I think you're one of my favorite people today.

I think that array-closing, right there, is the answer. Thank you!