Hello!
<div id="myElement1"></div>
<div id="myElement2"></div>
<script>
window.onload = function() {
document.getElementById("myElement1").onclick = function() {
for (i = 0; i < 2; i++) {
document.getElementById("myElement2").onmouseover = func;
function func() {alert("hello"); } } } }
</script>
In chrome and IE, when myElement1 is clicked, func is attached perfectly to myElement2. However, in firefox when myElement1 is clicked I receive an error message stating that func is not defined.
I should note that if make an anonymous function instead of func then it works in all 3 browsers.
My question is how does firefox handle scope in this regard differently to IE and chrome?
Will.