views:

167

answers:

1

i have a web page that contain two frames such as menu at the left side and content at the right side. in the content frames, i've used onbeforeunload function that fires whenever user want to close that webpage if they do not fill all the information. the problem is, onbeforeunload fires when i click on menu's frame. is there any way to solve this? sorry for my english** thanks

A: 

You could wire up the onclick of the link and stop the event from bubbling up to the window. This will stop the link from calling onunload because the frame will not unload. You could then do what you wanted in absence of anchor onclick event.

I think this will do it:

function handleClickEvent (event) {  
    event.stopPropagation();
    // do your thing there.
}

More about stop propagation here: MDC Event Propagation

thesmart