/    Sign up×
Community /Pin to ProfileBookmark

opening and closing windows

My main browser window has “File1.cfm” loaded.
Upon clicking a button, a popup window appears via
var nwin = window.open(‘DoSpellAccess.cfm?text=’+textData+’);

Within this new “pop-up” window, I have another button.
Upon clicking this button, I would like the “pop-up” window to close and
subsequently have the main browser window load a different “File2.cfm”.

This should be trivial, but since I’m a newb I’m having trouble.
Please help.
Thanks

-Gary

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzFeb 26.2006 — if(window.opener && !opener.closed)window.opener.location='File2.cfm';
self.close();
Copy linkTweet thisAlerts:
@cshow365authorFeb 26.2006 — That did it.

Thanks!!!!!
Copy linkTweet thisAlerts:
@d333muApr 17.2006 — hi i was wondeing if some assistance was possible i have popup window but within the popup window i also want a clse button i have inserted it but it dosnt seem to work

<html>

<head>

<script type="text/javascript">

var mypage = null;

function loadPage(url)

{

if(mypage)

{

if (!mypage.close)

mypage.document.location.href = url;

return true;

}

else

mypage = window.open(url, '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 262,top = 134');

}


<BODY>

<P><A HREF="a001.asp" onClick="window.close('popup');return false">Close me.</A></P>

</BODY>


function makeDog(){

var s = document.getElementById('size');

var c = document.getElementById('coat');

var e = document.getElementById('energy');

var y = document.getElementById('yes').checked;

var n = document.getElementById('no').checked;

var bully = new Array('s','s','l',false,'bully.jpg');

var rex = new Array('s','s','h',true,'rex.jpg');

var daisy = new Array('s','l','l',true,'daisy.jpg');

var dot = new Array('m','s','h',true,'dot.jpg');

var sam = new Array('l','l','l',true,'sam.jpg');

var pip = new Array('l','s','h',true,'pip.jpg');

var cyril = new Array('s','l','l',false,'cyril.jpg');

var bones = new Array('l','s','l',true,'bones.jpg');

var liquorice = new Array('m','s','h',true,'liquorice.jpg');

var fang = new Array('l','s','h',false,'fang.jpg');

var dogs = new Array(bully, rex, daisy, dot, sam, pip, cyril, bones, liquorice, fang);

if(((y == false)&&(n==false))||(s.value==null)||(c.value==null)||(e.value==null)){

alert('You must answer each question before preceeding.');

return false;

}

var i;

for(i=0;i<dogs.length;i++)

{

if((s.value==dogs[i][0])&&(c.value==dogs[i][1])&&(e.value==dogs[i][2])&&(y==dogs[i][3]))

{

loadPage(dogs[i][4],'');

return true;

}

}

}

</script>

</head>

<body>

<form id="mainform">

<div></div>

<fieldset><legend><CENTER>What size of dog are you looking for? </legend><select id="size">

<option>

<option value="l">Large

<option value="m">Medium

<option value="s">Small

<option value="d">Don't Care

</select><p></CENTER></fieldset>





<div></div>

<fieldset><legend><CENTER>What type of coat would you like your dog to have? </legend> <select id="coat">

<option>

<option value="s">Short

<option value="l">Long

<option value="d">Don't Care

</select><p></CENTER></fieldset>





<div></div>

<fieldset><legend><CENTER>How energetic would you like the dog to be ? </legend><select id="energy">

<option>

<option value="h">High Energy

<option value="l">Low Energy

<option value="d">Dont't Care

</select><p></CENTER></fieldset>





<div></div>

<fieldset><legend><CENTER>Do you require the dog to be good with children? </legend></select> <br>

Yes <input type="radio" NAME="child" VALUE="" id="yes">

No <input type="radio" NAME="child" VALUE="" id="no"><p></CENTER></fieldset>



<div></div>

<fieldset><CENTER><legend><input type="button" <input type="button" onclick="makeDog()" value="Submit"></CENTER></fieldset>

<fieldset><CENTER><legend><INPUT TYPE=reset></CENTER></fieldset>

</form></body></html>
×

Success!

Help @cshow365 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...