Problem with document.write()

Problem is only present in IE8 when script element is directly contained within a display:block element - unfortunately unable to test that here.

by w3dx

HTML

<img src="img/one.jpg" width="100" height="75" alt="1st Demo Image" title="">
<img src="img/two.jpg" width="100" height="75" alt="2nd Demo Image" title="">
<img src="img/three.jpg" width="100" height="75" alt="3rd Demo Image" title="">
<img src="img/four.jpg" width="100" height="75" alt="4th Demo Image" title="">

<p>Problem is only present in IE8 when script element is directly contained within a display:block element - unfortunately unable to test that here.</p>

JavaScript

// Ok in all browsers
for (var i=0; i<document.images.length; i++) {
    document.write('<br>',i,' - ',document.images[i]['src']);
}

// Only the first line is output in IE8 if contained within a block-level element with no surrounding white-space
for (var i=0; i<document.images.length; i++) {
    document.write('<br>',i,' - ',document.images[i]['width']);
}