Don84 said:
I just tried your code, not working (with IE7 and Firefox 3.5 both on
Windows Vista Home Premium). The complete test code below. [...]
Maybe I didn't do something right.
<html>
<head>
<title></title>
<script type="text/javascript">
Validity aside, this cannot work because at this point the BODY element has
not yet been parsed and therefore the object otherwise referred to by
`document.body' is unavailable. You need to call a function (e.g., in the
`onload' attribute value), or place the SCRIPT element in the BODY element.
PointedEars
Man, silly me, totally out of mind!
The static one is working. The following one which is generated
dynamically with a loop count of 4 failed to render the dot. What
have I missed?
Many thanks.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
function addDot() {
var div100 = document.createElement("div100");
if (div100)
{
/* TODO: add more feature tests here */
/* Some layout engines don't display elements without content */
div.appendChild(document.createTextNode("div100"));
// div.style.position = "absolute";
div.style.position = "relative";
div.style.left = "100";
div.style.top = "190px";
div.style.width = "20px";
div.style.height = "20px";
div.style.backgroundColor = "red";
document.body.appendChild(div100);
}
var div200 = document.createElement("div200");
if (div200)
{
/* TODO: add more feature tests here */
/* Some layout engines don't display elements without content */
div.appendChild(document.createTextNode("div200"));
// div.style.position = "absolute";
div.style.position = "relative";
div.style.left = "200";
div.style.top = "290px";
div.style.width = "20px";
div.style.height = "20px";
div.style.backgroundColor = "red";
document.body.appendChild(div200);
}
var div300 = document.createElement("div300");
if (div300)
{
/* TODO: add more feature tests here */
/* Some layout engines don't display elements without content */
div.appendChild(document.createTextNode("div300"));
// div.style.position = "absolute";
div.style.position = "relative";
div.style.left = "300";
div.style.top = "390px";
div.style.width = "20px";
div.style.height = "20px";
div.style.backgroundColor = "red";
document.body.appendChild(div300);
}
var div400 = document.createElement("div400");
if (div400)
{
/* TODO: add more feature tests here */
/* Some layout engines don't display elements without content */
div.appendChild(document.createTextNode("div400"));
// div.style.position = "absolute";
div.style.position = "relative";
div.style.left = "400";
div.style.top = "490px";
div.style.width = "20px";
div.style.height = "20px";
div.style.backgroundColor = "red";
document.body.appendChild(div400);
}
}
</script>
</head>
<body onload="addDot()">
<h1>Multi-dimensional view of data sets</h1>
</body>
</html>