|
this problem occured to me . javascript nested elements onclick problem when u call the same function not calling inner elements onclick
Actually the innter as well as the outer ones are called. if you just put up a message box you can see it. try displaying the innerHTML of the element. you can see it works
problem with me was i thaught the inner onclick was not called as i always get the data from the other element.
This is caused by bubbling
Here's the solution to stop problms with nested function calls
document.getElementById('template').onclick = function(e){pagebuilderclick(e,this);}
function pagebuilderclick(evnt,ele)
{
if(navigator.appName == "Microsoft Internet Explorer")
{
if (!e) var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation)
e.stopPropagation();
}else
{
evnt.stopPropagation();
evnt.cancelBubble = true;
}
}
|