Kiran Makam wrote:
Quote:
I am setting the content of a div dynamically using innerHTML
property. If the content contains an ampersand, text after the
ampersand is disappearing in IE6. It works properly in Firefox.
|
It works properly in both UAs, because there is no public standard that
defines how syntax errors MUST be handled. The HTML 4.01 Specification only
makes suggestions in that regard:
<http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.1>
Quote:
This is my code:
----------------
<body>
|
The DOCTYPE declaration and the required `title' element are missing.
Quote:
<div id='div1'></div>
<script>
|
The #REQUIRED `type' attribute is missing.
Quote:
|
var div = document.getElementById('div1');
|
You should do feature tests before you call anything.
See below.
Quote:
</script>
>
</body>
---------------
>
IE6 renders the content of div1 as 'A'
|
That is correct.
Quote:
|
Firefox renders the content properly as 'A&B'
|
That is also correct.
Quote:
|
If there is a space after ampersand, IE6 renders it properly.
|
And that is correct as well.
Quote:
So I think that IE is assuming anything after ampersand as an HTML entity
( like ).
|
Which is standards compliant.
No, the bug is in your code.
Quote:
|
Is there any workaround for this?
|
Either
&
or (better) using standards-compliant properties instead of the proprietary
`innerHTML' property.
Validate your code before you complain about browsers next time.
<http://validator.w3.org/>
<http://jibbering.com/faq/>
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>