iceboxqs
06-08-2004, 07:06 PM
I find myself here yet again,
Again I am using an editable document in a web page. (document.body)
In IE using outerHTML you can convert a <br> inside a div to </div><div> thus creating two divs that give you the same effect as a <br>.
For example:
I want to change this:
<div>Here is some content. <br> Here is the second line.</div>
To this:
<div>Here is some content. </div><div> Here is the second line.</div>
Using mozilla 1.7 if you use the outerHTML the editor changes the "backwards " tag </div><div> to <div></div>, which obviously I do not want.
Heh, I tried making a text node and replacing the <br> but since it's a text node the html code is converted to html character entites.
I'm sure this one will keep me busy for a while. I know I could walk through the current node find all the nodes before the <br> and all the nodes after the <br>, delete the <br>'s parent, create two seprate div's for the content on either side of the <br> and finally insert those two divs.
Pretty ugly though, I was hoping someone would have a much better idea on how this could be done.
Thanks again for your time.
Again I am using an editable document in a web page. (document.body)
In IE using outerHTML you can convert a <br> inside a div to </div><div> thus creating two divs that give you the same effect as a <br>.
For example:
I want to change this:
<div>Here is some content. <br> Here is the second line.</div>
To this:
<div>Here is some content. </div><div> Here is the second line.</div>
Using mozilla 1.7 if you use the outerHTML the editor changes the "backwards " tag </div><div> to <div></div>, which obviously I do not want.
Heh, I tried making a text node and replacing the <br> but since it's a text node the html code is converted to html character entites.
I'm sure this one will keep me busy for a while. I know I could walk through the current node find all the nodes before the <br> and all the nodes after the <br>, delete the <br>'s parent, create two seprate div's for the content on either side of the <br> and finally insert those two divs.
Pretty ugly though, I was hoping someone would have a much better idea on how this could be done.
Thanks again for your time.