Avatar of Loganathan Natarajan
Loganathan Natarajan
Flag for India asked on

How do I resolve the pop up close issue?

Please ref. https://www.experts-exchange.com/questions/24211970/How-do-I-close-the-pop-up.html

I have been tried to put the "Dialog.okCallback();" on the body tag like this,

<body onclick="Dialog.okCallback();" bgcolor="#333333">

It works in FF, not in IE... How do I resolve this.

I have attached the complete (simple script)... Please look at it.

Download the source, http://boscoits.com/popwindow.zip
JavaScriptPHPScripting Languages

Avatar of undefined
Last Comment
Michel Plungjan

8/22/2022 - Mon
Michel Plungjan

try




<html>
<head>
<script type="text/javascript">
window.onload=function() {
  if (document.body && document.body.attachEvent) {
    document.body.attachEvent('onclick',function() {Dialog.okCallback()});
  }
  else document.body.onclick=function() { Dialog.okCallback() }
}
</script>
</head>
<body>
.
.

Open in new window

Loganathan Natarajan

ASKER
I tried like this,

the same error persists,

<html>
<head>
<title>Test</title>
 
<link href="themes/default.css" rel="stylesheet" type="text/css" ></link> 
<link href="themes/alphacube.css" rel="stylesheet" type="text/css" ></link>
 
<script type="text/javascript" src="javascripts/prototype.js"></script>
<script type="text/javascript" src="javascripts/effects.js"></script>
<script type="text/javascript" src="javascripts/application.js"></script>  	
<script type="text/javascript" src="javascripts/window.js"></script>
 
<script type="text/javascript">
window.onload=function() {
  if (document.body && document.body.attachEvent) {
    document.body.attachEvent('onclick',function() {Dialog.okCallback()});
  }
  else document.body.onclick=function() { Dialog.okCallback() }
}
</script>
 
 
<script type="text/javascript">
	var win = null;
	var index = 1;
 
	function openDialog(id,popupbg,pwidth) 
	{
	  //alert("Hello "+pwidth);
	  Dialog.alert($(id).innerHTML, {className: "alphacube",  width: pwidth, id: "d" + index, popupbg: popupbg})
	  index++;
	}
	
	function lastDialog(id) 
	{
	  Dialog.confirm($(id).innerHTML, {className: "alphacube",  width:250, okLabel: "Close All", ok: closeAllModalWindows})
	}
	
	function closeAllModalWindows() 
	{
		Windows.closeAllModalWindows();
		return true;
	}
	function okCallback() {
       win.close();
    }
  }
</script>
 
 
</head>
<body bgcolor="#333333">
<div>
	<script>Application.addInfo(' ', 'info')</script>
	<div style="display:none"> 
		<xmp id="info">
			Dialog.alert({url: "info.htm", options: {method: 'get'}}, 
			{
				className: "alphacube",
				width:400, 
				okLabel: "Close"
			}
			);
		</xmp>
	</div>	
</div>
</body>
</html>

Open in new window

Loganathan Natarajan

ASKER
I am getting this on the screen.

ERR2.JPG
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Michel Plungjan

Where is
new Dialog instantiated?
Loganathan Natarajan

ASKER
It is there in window.js


    var win = new Window(parameters);
    win.getContent().innerHTML = content;
    
    win.showCenter(true, parameters.top, parameters.left);  
    win.setDestroyOnClose();
    
    win.cancelCallback = parameters.onCancel || parameters.cancel; 
    win.okCallback = parameters.onOk || parameters.ok;
    
    return win;    
  },

Open in new window

Loganathan Natarajan

ASKER
everything is there in the .js file?

Can you see it from the attachment please?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Michel Plungjan

Sorry I did not see the zip in the question
Michel Plungjan

You have a curly bracket too many

<script type="text/javascript">
	var win = null;
	var index = 1;
 
	function openDialog(id,popupbg,pwidth) 
	{
	  //alert("Hello "+pwidth);
	  Dialog.alert($(id).innerHTML, {className: "alphacube",  width: pwidth, id: "d" + index, popupbg: popupbg})
	  index++;
	}
	
	function lastDialog(id) 
	{
	  Dialog.confirm($(id).innerHTML, {className: "alphacube",  width:250, okLabel: "Close All", ok: closeAllModalWindows})
	}
	
	function closeAllModalWindows() 
	{
		Windows.closeAllModalWindows();
		return true;
	}
	function okCallback() {
       win.close();
    }
  } <<<<<<<<<< remove

Open in new window

Michel Plungjan

I get

Error: win is null
Source File: window.js
Line: 1569

which is

okCallback: function() {
    var win = Windows.focusedWindow;

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Loganathan Natarajan

ASKER
I have removed the extra " }  "  ... OK, syntax error is fixed...

but my original error remains the same... after the pop up window open, if I click the out side ... there is error ...

see the attachment...

so i too face the same error on line number 1569 in window.js file

ERR3.JPG
ASKER CERTIFIED SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Loganathan Natarajan

ASKER
That worked it. Thank  you sir. really you are so great!!!

I never thought to handle the null in my programming experience on the javascript...
Loganathan Natarajan

ASKER
Fantastic Answers. Thanks so much!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Michel Plungjan

It does leave the qestion WHY there is no focussed window set in the code