Here's a code that I originally wrote in Notepad:
Code:
<script>
alert ("THIS IS MAGIC");
document.bgColor = "BLACK";
</script>
<script>
alert ("UH OH!!!");
document.bgcolor = "ORANGE";
</script>
<html>
<head>
<script>
alert ("AND AGAIN");
document.bgColor = "RED";
</script>
<title> JAVA DOC 1 </title>
</head>
<body>
<h2> <p align = center> <br><br> This is my first piece of JavaScript code. </p> </h2>
</body>
</html>
And Firebug 1.9.0a0 made it into:
Code:
html>
<head>
<script>
alert ("THIS IS MAGIC");
document.bgColor = "BLACK";
</script>
<script>
alert ("UH OH!!!");
document.bgcolor = "ORANGE";
</script>
<script>
alert ("AND AGAIN");
document.bgColor = "RED";
</script>
<title> JAVA DOC 1 </title>
</head>
<body>
<h2>
<p align="center">
<br>
<br>
This is my first piece of JavaScript code.
</p>
</h2>
</body>
</html>
That's how browsers change the code, right?
Now the problem is that after the browser tidies up the code, the background colour is set first to black, orange then red. So finally red, right?
But the output is simple:
"This is my first piece of JavaScript code." in black on a white background.
Can somebody explain this please?