You are here: empty P tags and linebreaks « HTML « IT news, forums, messages
empty P tags and linebreaks

Posted by allie on 11/02/06 12:55

I have a problem with inconsistency in IE browser, looking at the
innerHTML property and the actual contents.

I used this in a plain HTML page:

<div contenteditable="true" style="border:solid 1px black"
onblur="alert(this.innerHTML)">
</div>

If you type content with an extra linebreak, and press TAB to leave the
field, you see for example:
<p>a</p>
<p>&nbsp;</p>
<p>b</p>

Note that if you use the cursor to browse the DIV, you do NOT see
actually a space for the second line, there is in fact no space, it is
a empty line.

But if you place exactly this same content inside the editable DIV,
like this:

<div contenteditable="true" style="border:solid 1px black"
onblur="alert(this.innerHTML)">
<p>a</p>
<p>&nbsp;</p>
<p>b</p>
</div>

and then reload your page, then suddenly you DO see the space. How can
this be? How can the innerHTML property be different from the actual
contents ?

Please help me with this ...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация