I am a newbie to JavaScript and XML. I have a string that has newlines embedded into it. But when I display the string in XML it prints out one row. I am trying to write a JavaScript function to parse the string and then display it correctly. I am not sure if my problem is with JavaScript, XML or both.
Here is my JavaScript and how I call the function in the XML:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript" charset="utf-8">
<![CDATA[
function NoteFormat(NoteText)
{
var ParsedNoteArray = NoteText.split(/\n/);
for (i=0; i<ParsedNoteArray.length; i++)
{
document.write(ParsedNoteArray + "<br>");
}
}
]]>
</SCRIPT>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:NoteFormat({@Note})"></a>
Here is my JavaScript and how I call the function in the XML:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript" charset="utf-8">
<![CDATA[
function NoteFormat(NoteText)
{
var ParsedNoteArray = NoteText.split(/\n/);
for (i=0; i<ParsedNoteArray.length; i++)
{
document.write(ParsedNoteArray + "<br>");
}
}
]]>
</SCRIPT>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:NoteFormat({@Note})"></a>