these are my codes(testing it in IE8)
thanks a lot for your reply and my apologies for that.well I tried as you said writing return false but it did not worked.The actual scenario is ,I have a page(parent page) with one button called popup,when user clicks on the pooup button,(the child page)the popup window will appear and the popup window contains a text field which is mandatory field.if the user clicks on a popup window close button without entering text in a textfied we need to display a alert message.
I am done up to the displaying the alert message,but when user clicks onthe ok button of alert message box its returning to the parent page,but i dont want to that happen,I need to show the popup window untill user enters the text.
thanks for your Link and as you suggested I followed the code as it is in the link.then also i could not bale to do below are my codes
if i have writeen jusr "return null" then its also returning to the previous page.Is there anyway to make it work?
Joined: Nov 08, 2001
There is NO WAY to prevent the user from not leaving the page. That is how a browser works. IF they press Ok, they will go to wherever the page is going to. If they push cancel, they will stay on the current page.
If you need to force input, than you SHOULD NOT use a pop up. Use a modal layer in the orgainl page. An example is jQuery UI dialog.