I am not familiar with standard of DHTML, and it make make me more confused that each internet explorers has it’s own implementation of DHTML (the model and the vision).
I thought that the “body” of a html means the area which we can see in an explorer, it is true when using Microsoft Internet Explore but not when using Fire Fox.
The following code fragment try to prove it:
<html>
<head>
<title>Test click on body</title>
<script src="mootools-1.2.1-core.js"></script>
</head>
<body>
<script type="text/javascript">
window.addEvent("domready",function()
{
$(document.body).addEvent("click",function()
{
alert("Click body");
});
});
</script>
</body>
</html>
In Microsoft’s explorer, you can get the dialog showing “Click body” when clicking anywhere in the client area, but no dialog shown in Fire Fox. Fire Fox explains the term “body” as the area which “contains” any HTML elements. As you can see in the preceding source code, there is no elements in the body, thus the event can not be triggered.
There is a weird way to resolve this problem in Fire Fox: <body style=”height:100%”> .
It is really weird!