P
pamelafluente
Ok I am trying to attach the handlers dynamically:
(within a JS file: )
-------------------------------------------------------
window.onload = addCellHandlers();
function addCellHandlers() {
var foundDivs = document.body.getElementsByTagName("div");
var divElement;
for ( var i = 0; i < foundDivs.length; i++ ) {
divElement = foundDivs;
if ( divElement.getAttribute("hasHandlers") == "True" ) {
divElement.onclick="cellClick(event,this)" ;
divElement.onmouseover = "mOver(this)" ;
divElement.onmouseout = "mOut(this)" ;
}
}
}
hmm this gets called, but does not seem to attach any handler.
I suspect that foundDivs is empty and I am probably invoking this in
the wrong way.
Is there some kind of afterLoad event ?
How do I correctly add handlers to my DIVs?
-P
(within a JS file: )
-------------------------------------------------------
window.onload = addCellHandlers();
function addCellHandlers() {
var foundDivs = document.body.getElementsByTagName("div");
var divElement;
for ( var i = 0; i < foundDivs.length; i++ ) {
divElement = foundDivs;
if ( divElement.getAttribute("hasHandlers") == "True" ) {
divElement.onclick="cellClick(event,this)" ;
divElement.onmouseover = "mOver(this)" ;
divElement.onmouseout = "mOut(this)" ;
}
}
}
hmm this gets called, but does not seem to attach any handler.
I suspect that foundDivs is empty and I am probably invoking this in
the wrong way.
Is there some kind of afterLoad event ?
How do I correctly add handlers to my DIVs?
-P