elabuwa Posted December 2, 2011 Share Posted December 2, 2011 Hi guys, I have read that the window.close won't work unless the window was opened through window.open. Eventhough I have the window opening through window.open method the window.close simply wont close the window. Below is my code. I appreciate you help as I am desperate to finish my project and this is the only thing between me and the closed project. I have this in the <head> in the parent window. <script language="javascript"> function MM_openBrWindow(theURL,winName,features){ var left = (screen.width/2)-(800/2); var top = (screen.height/2)-(560/2); features = features + ",left=" + left; window.open(theURL,winName,features); } </script> the left and top is to center the window which is working. Then I have the below code in my button which is to open the window. <input type="button" value="E-MAIL" onClick="MM_openBrWindow('email.php?camp_id=<?php echo $encrypted; ?>','','width=860,height=600'); return false"/> The $encrypted is created beforehand and the window gets opened as well. Now in the popup window... Up on submitting a form, I need the popup to close after saying 'email has been sent'. function err_check(){ var email = document.getElementById('to_email').value; if(email.length==0){ alert('Please Enter Email Address'); return false; } var AtPos = email.indexOf("@") var StopPos = email.lastIndexOf(".") if (AtPos == -1 || StopPos == -1) { alert("Please Enter Valid Email Address"); document.getElementById('to_email').focus(); return false; } email = document.getElementById('cc_email').value; if(email.length != 0){ var AtPos = email.indexOf("@") var StopPos = email.lastIndexOf(".") if (AtPos == -1 || StopPos == -1) { alert("Please Enter Valid Email Address"); document.getElementById('cc_email').focus(); return false; } } var answer = confirm ("Send E-Mail?"); if (!answer){ return false; } } function success(){ alert('E-Mail Sent Successfully'); window.close(); } I even get the alert mentioning "E-Mail Sent Successfully". But simply the window is not closed. Can you guys please shed me some light on this.... Your help is greatly appreciated Ohh and by the way I'm running FF8. Cheers E Quote Link to comment https://forums.phpfreaks.com/topic/252315-windowclose-not-working-with-ff/ Share on other sites More sharing options...
elabuwa Posted December 2, 2011 Author Share Posted December 2, 2011 sorry boys. I have added an unnecessary function. please ignore the err_check function. echo "<script language='javascript'>success();</script>"; calls the the alert and window.close procedures. I even get the alert. Quote Link to comment https://forums.phpfreaks.com/topic/252315-windowclose-not-working-with-ff/#findComment-1293485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.