Re: Problem with alert and \n in javascript !
From: Jelmer (jkuperus_at_planet.nl)
Date: 04/14/04
- Next message: SirfGuru: "Re: Get hold of a object in the different frame after it returnd from a POST"
- Previous message: Farm: "RE: Problem with alert and \n in javascript !"
- In reply to: Farm: "Problem with alert and \n in javascript !"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 14 Apr 2004 13:39:57 +0200
You mean you the xml you retrieve is send over the wire like this?
<root>
<element>something\nsomething else</element>
</root>
that doesn't work, \n is an escape sequence and that instructs the parser
to replace it with the chosen sequence when it encounters it in program code
in your case your not writing code your retrieving a string , so the string
is never parsed just send a real linefeed in your xml
"Farm" <eritreoc@hotmail.com> wrote in message
news:B96A8E7F-870B-4EF1-BBA5-B042EB028A49@microsoft.com...
> Hi, I have a problem with special character \n using in alert() function
that shows \n character like string and not as carriage return.
>
> Release note:
> -------------------------------------------------------------------
> I use javascript in Internet Explorer 6.0
> SO Windows XP Italian version sp2
> I extract some literal text that contain \n from XML node using
Microsoft.XMLHTTP object (for example the literal string 'Save the\n
record?')
> I retrieve XML from my web services
>
> Same Code:
> -------------------------------------------------------------------
> <script language=javascript>
> //<!--
> function GetNodeText() {
>
> var TextNode
> TextNode= xmlDoc.selectSingleNode('//ReadRecordResult') ;
> if (TextNode != null) {
> return TextNode.text ;
> } else {
> return empty;
> }
> }
>
> //...and I pass result of this function to alert():
>
> alert(GetNodeText()) ;
>
> // --></script>
>
> Can you give us some advice ?
>
> Thank you very much.
- Next message: SirfGuru: "Re: Get hold of a object in the different frame after it returnd from a POST"
- Previous message: Farm: "RE: Problem with alert and \n in javascript !"
- In reply to: Farm: "Problem with alert and \n in javascript !"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|