Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1444 I want to open a small dialog box on the screen, ask a yes/no question and have 2-3 buttons: yes, no, and cancel, depending on which is selected, the appropriate page is then displayed in the browser window - is this possible and how might it be done?

You are here: irt.org | FAQ | JavaScript | Window | Q1444 [ previous next ]

Try:

<script language="JavaScript"><!--
function promptIt() {
   WinId = window.open('questionpage.html','newwin','width=300,height=300,status');
   if (!WinId.opener) WinId.opener = self;
}
//--></script>

and in questionpage.html (that page can also be written dynamically, but will complicate things a little) have:

<center>
<form>
Do you know Aaron?
<br>
<input type="button" value="Yes" onClick="opener.location='yespage.html'; self.close()">
<input type="button" value="No" onClick="opener.location='nopage.html'; self.close()">
<input type="button" value="Cancel" onClick="self.close()">
</center>

©2018 Martin Webb