Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.