D
Dave
Hello,
I'm working with DHTML in a web application I'm building and I've run
into a problem that I'm not sure is resolvable.
I've been using the innerHTML and outerHTML properties of elements in
my web pages and grabbing the desired elements by assigning an ID and
then using the document.getElementById() method to retrieve an object
reference to the desired element. This is not a problem and works in
all the 5+ versions of IE I've tested (on Windows and Mac platforms).
The problem is that the string returned from the innerHTML or
outerHTML property does not preserve the quotes located in the text in
the actual document. So the following element:
<XML ID="xml_test">
<nodes>
<node myname="some_name">1</node>
<node myname="some_name">2</node>
</nodes>
</XML>
if shown with, say, alert(document.getElementById("xml_test").outerHTML)
would create a popup containing:
<XML ID=xml_test>
<nodes>
<node myname=some_name>1</node>
<node myname=some_name>2</node>
</nodes>
</XML>
The reason this is problematic is that there are times I wish to use
the element text literally, and the missing quotes pretty much screws
the javascript functions I've already written.
If anyone knows how to code around this issue or if there is a fix for
it that can be applied to the browser so it will show literal text
from these properties, please post an answer in reply to one of these
groups. Sorry for the cross-posting but I really need to figure out a
way around this and don't know which group is most appropriate.
Thanks in advance for your help.
Regards,
Dave Spaar
I'm working with DHTML in a web application I'm building and I've run
into a problem that I'm not sure is resolvable.
I've been using the innerHTML and outerHTML properties of elements in
my web pages and grabbing the desired elements by assigning an ID and
then using the document.getElementById() method to retrieve an object
reference to the desired element. This is not a problem and works in
all the 5+ versions of IE I've tested (on Windows and Mac platforms).
The problem is that the string returned from the innerHTML or
outerHTML property does not preserve the quotes located in the text in
the actual document. So the following element:
<XML ID="xml_test">
<nodes>
<node myname="some_name">1</node>
<node myname="some_name">2</node>
</nodes>
</XML>
if shown with, say, alert(document.getElementById("xml_test").outerHTML)
would create a popup containing:
<XML ID=xml_test>
<nodes>
<node myname=some_name>1</node>
<node myname=some_name>2</node>
</nodes>
</XML>
The reason this is problematic is that there are times I wish to use
the element text literally, and the missing quotes pretty much screws
the javascript functions I've already written.
If anyone knows how to code around this issue or if there is a fix for
it that can be applied to the browser so it will show literal text
from these properties, please post an answer in reply to one of these
groups. Sorry for the cross-posting but I really need to figure out a
way around this and don't know which group is most appropriate.
Thanks in advance for your help.
Regards,
Dave Spaar