<html>
<body>
</body>
</html>
<script>
for(var row=0; row < 5; row ++) {
for(var col=0; col < 5; col ++) {
var obj = document.createElement("div");
with(obj.style) {
width = "50px";
height = "50px";
position = "absolute";
border = "10px solid gray";
left = 100*col + "px";
top = 100*row + "px";
}
obj.innerHTML = row+":"+col;
document.body.appendChild(obj);
obj.onclick = function() {
alert(obj.innerHTML);
};
}
}
</script>
<body>
</body>
</html>
<script>
for(var row=0; row < 5; row ++) {
for(var col=0; col < 5; col ++) {
var obj = document.createElement("div");
with(obj.style) {
width = "50px";
height = "50px";
position = "absolute";
border = "10px solid gray";
left = 100*col + "px";
top = 100*row + "px";
}
obj.innerHTML = row+":"+col;
document.body.appendChild(obj);
obj.onclick = function() {
alert(obj.innerHTML);
};
}
}
</script>