Jump to content

window.close not working with FF


elabuwa

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/252315-windowclose-not-working-with-ff/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.