Sagewire Logo

Dynamically created Elements... not working on IE, yes on Firefox

3 Message(s) by 2 Author(s) originally posted in javascript


From: zoropoteame Date:   Tuesday, April 24, 2007
In one function I create a DIV element:

var card = document.createElement("div");
card.setAttribute("onmouseover", "myOtherFunction()");
document.getElementById(p_destination).appendChild(card);

This is a dynamic load element, this isn't constructed on the server,
but rather through JAVAscript.

When viewed in Firefox this works and the "myOtherFunction()" gets
executed. When viewed in IE it doesn't work.

Anybody got any idea why?


From: Marcel Molenaar Date:   Thursday, April 26, 2007
In one function I create a DIV element:
var card = document.createElement("div");
card.setAttribute("onmouseover", "myOtherFunction()");
document.getElementById(p_destination).appendChild(card);
This is a dynamic load element, this isn't constructed on the server,
but rather through JAVAscript.
When viewed in Firefox this works and the "myOtherFunction()" gets
executed. When viewed in IE it doesn't work.
Anybody got any idea why?



Is p_destination a variable? If not then you should use:
document.getElementById("p_destination").appendChild(card);

Regards,

Marcel


From: Marcel Molenaar Date:   Thursday, April 26, 2007
In one function I create a DIV element:

var card = document.createElement("div");
card.setAttribute("onmouseover", "myOtherFunction()");
document.getElementById(p_destination).appendChild(card);

This is a dynamic load element, this isn't constructed on the server,
but rather through JAVAscript.

When viewed in Firefox this works and the "myOtherFunction()" gets
executed. When viewed in IE it doesn't work.

Anybody got any idea why?

Is p_destination a variable? If not then you should use:
document.getElementById("p_destination").appendChild(card);
Regards,
Marcel



Sorry this doesn't seem to work in IE5+ (see
http://www.pxl8.com/setAttribute_test.html#foot1)

Workaround is this:

card.setAttribute('onmouseover',function myOtherFunction(){alert(TEST');});

Marcel



Next Message: Pass a variable


Blogs related to Dynamically created Elements... not working on IE, yes on Firefox

Exam2 Combo
tions of reef are considered extensions of residential ing that “being better than others” (ie, getting larger. plots: use-rights to residential plots are shared by all harvests) depends solely on working long hours, not on ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional