"dispatchEvent()" in NS7 doesn't fire!

admin

Administrator
Staff member
Hello Everybody!

The following code is an experiment on the application of the method: "createEvent()" along with the associated other members/methods, so as clicking the outer square transfer the event (clicking) to the inner square.
The code is supposed to work in both: IE6 and NS7, and it works OK with IE6 but it seems to have something wrong relating NS7 which I do not know.
May someone help me, please, find it out.


<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.out{height:120; width:120; background-color:#ff9966}
.in{position:relative; top:25%; left:25%; height:60; width:60; background-color:lavender} /*(2)*/
-->
</STYLE>
<SCRIPT type="text/javascript">
<!--
var state;
function Hawwil(EVENT, wad?{
state= wad?
if(window.event){
WAQEA= document.createEventObject(EVENT);
DAKHEL.fireEvent("onclick",WAQEA);
}
else{
WAQEA= document.createEvent("MouseEvents");
DAKHEL.dispatchEvent(WAQEA);
}
}
function Estajeb(EVENT){
if(state) alert("The inner square is the original source of the event");
else alert("Event has transfered to the inner square");

if(window.event) EVENT.cancelBubble= true;
else EVENT.stopPropagation= true;
}
// -->
</SCRIPT>
</HEAD> <BODY>
<DIV id="OUTER" class="out" onclick="Hawwil(event, false)">
<DIV id="INNER" class="in" onclick="Estajeb(event); state=true"></DIV>
</DIV> <!--(1)-->
<SCRIPT type="text/javascript">
KHAREJ= document.getElementById("OUTER");
DAKHEL= document.getElementById("INNER");
</SCRIPT>
</BODY>
</HTML>
 
Top