i was trying some test of Javascript, and then if I use
then nothing is shown in IE 7 or FF 3, but it shows on Chrome... so I wonder which one is correct and why not showing?Code:<div id="divOutput" style="white-space: pre"></div> <script> document.getElementById('divOutput').innerHTML = document.getElementById('divOutput').innerHTML + "hello\n"; document.getElementById('divOutput').innerHTML = document.getElementById('divOutput').innerHTML + "world\n"; </script>
And then when I add the HTML 4.01 strict doctype and make it validate:
then something shows on IE 7, FF 3, and Chrome, but on IE 7, the lines are not broken down into 2 lines, as expected by the "white-space: pre". On FF 3 and Chrome, they are broken into 2 lines. So this is another weird thing... and is FF 3 and Chrome more correctly doing it? Many thanks.Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> JS test </title> </head> <body> <div id="divOutput" style="white-space: pre"></div> <script type="text/javascript"> document.getElementById('divOutput').innerHTML = document.getElementById('divOutput').innerHTML + "hello\n"; document.getElementById('divOutput').innerHTML = document.getElementById('divOutput').innerHTML + "world\n"; </script>






Bookmarks