MonsterMan
Programmer
The problem is that Firefox does not appear to recognise the event keyword when a new function is created dynamically. See line 14 in the code below. Any help would be really appreciated.
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript" >
function createTbl() {
var tblBody = document.createElement("tbody");
var row = document.createElement("tr");
var cell = document.createElement("td"); //Create the cell
cell.setAttribute("className","booking") // IE
cell.setAttribute("class","booking") // Firefox
cell.onclick = new Function("onclick=testClick(event)")
cell.innerHTML = "Click Me!"
row.appendChild(cell);
tblBody.appendChild(row);
var tbl = document.createElement("table");
tbl.appendChild(tblBody);
document.body.appendChild(tbl);
}
function testClick(evnt){ alert(evnt.clientX) }
</SCRIPT>
<style type="text/css">
<!--
.booking {
text-align: center;
background-color: #ddeeCC;
border: 1px solid #CCCCCC;
cursor: pointer;
}
-->
</style>
</head>
<body style="margin:50" onLoad="createTbl()" >
</body>
</html>