Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] TextNodes
- From: tallison at tacocat.net (Tom Allison)
- Subject: [Javascript] TextNodes
- Date: Thu Mar 30 15:53:01 2006
On 3/29/2006, "Vicente Gallur Valero" <vicente@xxxxxxxxxxxxxxxxxx> wrote: > >> >> I want to be able to pull from the server either a preformatted HTML >> string or a multiline string and insert it into the clients <div> >> segment. >> >> This I know presents some problems because the TextNode cannot, by >> definition, hold anything like a <b> or <p> tags. But I don't know >> enough of the alternatives to be able to sort this one out. Is there >> where responseXML takes precedence over the responseText method of the >> Request object? >> >> How do you use them? >> > >I think the easiest way is take always the responseText property instead >of responseXML, even if you use (X)HTML code in your response. Then you >can insert the code into the <div> by asigning it to the innerHTML >property of the <div>. If it contains HTML code, it will be parsed by >the browser. This method will not work in an XHTML document served with >an XHTML Content-type header. > >You can also use the responseXML property, but then you must ensure the >code is well formed XML and it's served with an XML Content-type header. >Then you can insert the code with the DOM methods. > OK, I didn't get to the innerHTML method yet. I'll have to give that a go. Thank you.
- References:
- [Javascript] TextNodes
- From: Vicente Gallur Valero
- [Javascript] TextNodes
- Prev by Date: [Javascript] Stopping default action
- Next by Date: [Javascript] Stopping default action
- Previous by thread: [Javascript] TextNodes
- Next by thread: [Javascript] To DOM or not -- calendar popup
- Index(es):