JustAnotherCode
03-16-2003, 11:28 PM
I'm having problems adding an onmouseover handler to objects I dynamically create.
I have the arrays created in the head of the page:
numwords=0;
poedivs = new Array();
poewords = new Array();
then.. a constructor
function word(text) {
numwords++;
this.text = text;
this.idnum = numwords;
poedivs[numwords] = document.createElement("DIV");
document.body.appendChild(poedivs[numwords]);
poedivs[numwords].innerHTML = text;
poedivs[numwords].style.cssText = "position:absolute; left:20px;top:200px; border:solid; border-width:2px";
//poedivs[numwords].attachEvent("onmouseover",alert());
}
I think these are both accurate. I seem to be able to create a new object while in the body of the page:
poewords[0] = new word("word");
however, I can't figure out how to add a handler for the onmouseover event to the dynamically created object. The last line there of the second code block, the one that's commented off, is one thing I've tried. doesn't work. it just gives an alert as the page loads. any suggestions?
btw... I only care if it works in IE6.
I have the arrays created in the head of the page:
numwords=0;
poedivs = new Array();
poewords = new Array();
then.. a constructor
function word(text) {
numwords++;
this.text = text;
this.idnum = numwords;
poedivs[numwords] = document.createElement("DIV");
document.body.appendChild(poedivs[numwords]);
poedivs[numwords].innerHTML = text;
poedivs[numwords].style.cssText = "position:absolute; left:20px;top:200px; border:solid; border-width:2px";
//poedivs[numwords].attachEvent("onmouseover",alert());
}
I think these are both accurate. I seem to be able to create a new object while in the body of the page:
poewords[0] = new word("word");
however, I can't figure out how to add a handler for the onmouseover event to the dynamically created object. The last line there of the second code block, the one that's commented off, is one thing I've tried. doesn't work. it just gives an alert as the page loads. any suggestions?
btw... I only care if it works in IE6.