From: Oliver Gargour (Garwin) on
Hello, I'm tring to write "ul" and "li" tags to an iframe with IE8

window.attachEvent('onload',function(){Build();});

function Build() {
var Temp = eval("Test");
Temp.document.open();
Temp.document.write("<html>" +
"<head>" +
"</head>" +
"<body>" +
"<ul><li>blablabla</li><li>tratratra</li></ul>" +
"</body>" +
"</html>");
Temp.document.close();
alert("Temp="+Temp.document.body.innerHTML); }

<iframe id="Test" src="about:blank" style="PADDING-RIGHT: 0px; PADDING-LEFT:
0px; PADDING-BOTTOM: 0px; WIDTH: 598px; PADDING-TOP: 0px; HEIGHT:
349px"></iframe>

The problem is that some of the "li" closing tags disappear!!!!

The above alert gives :
Temp=<UL>
<LI>Internet
<LI>Creation</LI></UL>


From: Lasse Reichstein Nielsen on
"Oliver Gargour \(Garwin\)" <oliver(a)garwin.be> writes:

> function Build() {
> var Temp = eval("Test");

Drop the eval, it does nothing here. You could just write
var Temp = Test;
I would recommend
var temp = document.frames['Test'];
instead, though.

> Temp.document.open();
> Temp.document.write("<html>" +
> "<head>" +
> "</head>" +
> "<body>" +
> "<ul><li>blablabla</li><li>tratratra</li></ul>" +
> "</body>" +
> "</html>");
> Temp.document.close();
> alert("Temp="+Temp.document.body.innerHTML); }

I take it this is not the actual code, and that the actual code is inside
the Build function.

> <iframe id="Test" src="about:blank" style="PADDING-RIGHT: 0px; PADDING-LEFT:
> 0px; PADDING-BOTTOM: 0px; WIDTH: 598px; PADDING-TOP: 0px; HEIGHT:
> 349px"></iframe>
>
> The problem is that some of the "li" closing tags disappear!!!!
>
> The above alert gives :
> Temp=<UL>
> <LI>Internet
> <LI>Creation</LI></UL>

The problem is your expectations :)
IE isn't following any standard with innerHTML, so there is no specified
way it must represent its document structure. Apparently it chooses to
omit the li end tag when building a string representation of the document.
The li end tag may be omitted in HTML, so that's perfectly reasonable.

Is there a problem with the display of the list?

/L
--
Lasse Reichstein Holst Nielsen
'Javascript frameworks is a disruptive technology'

From: David Mark on
Lasse Reichstein Nielsen wrote:
> "Oliver Gargour \(Garwin\)" <oliver(a)garwin.be> writes:
>
>> function Build() {
>> var Temp = eval("Test");
>
> Drop the eval, it does nothing here. You could just write
> var Temp = Test;
> I would recommend
> var temp = document.frames['Test'];
> instead, though.
>

Did you mean window.frames? I honestly don't know which is the
standard, but document.frames doesn't make much sense to me (and is
undefined in FF1).
From: David Mark on
David Mark wrote:
> Lasse Reichstein Nielsen wrote:
>> "Oliver Gargour \(Garwin\)" <oliver(a)garwin.be> writes:
>>
>>> function Build() {
>>> var Temp = eval("Test");
>> Drop the eval, it does nothing here. You could just write
>> var Temp = Test;
>> I would recommend
>> var temp = document.frames['Test'];
>> instead, though.
>>
>
> Did you mean window.frames? I honestly don't know which is the
> standard, but document.frames doesn't make much sense to me (and is
> undefined in FF1).

Oops, I meant "standard" (as in there is no real standard for the window
object).