[Javascript] RE: YES/NO Message box
uplate at attbi.com
uplate at attbi.com
Wed May 21 19:30:07 CDT 2003
Here's a little example that could be tweaked but works sufficiently as it is
The Main Document opens the yesno_popup.htm file which in turn calls the
"whichChoice" function in the Main document. You could certainly use gifs
instead of buttons on the popup. Good luck, I hope it helps.
here is the main document:
------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My Main Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
function whichChoice(YesNo)
{
if(YesNo)
{
alert('User Chose yes');
}
else
{
alert('User Chose no');
}
}
</script>
</head>
<body>
<form action="" method="POST" id="myForm">
<input type="Button" name="" value="Close" id="myButton" onClick="closeWindow
()">
<script type="" language="JavaScript">
function closeWindow() {
//myWindow.document.write("Click 'O.K'. to close me and 'Cancel' to
leave me open.")
window.open
("yesno_popup.htm","","width=200,height=200,toolbar=no,menubar=no");
}
</script>
</form>
</body>
</html>
-------------------------------------------------------------------------------
Here Is The popup document I named yesno_popup.htm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
function notifyParent(sInput)
{
window.opener.whichChoice(sInput);
window.close();
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<input type="button" name="Button" value="Yes" onClick="notifyParent(true)">
<input type="button" name="Submit2" value="No" onClick="notifyParent(false)">
</form>
</body>
</html>
> Hi Everyone,
>
> Has anyone got a neat workaround for a 'Yes/ No' message box in
> Javascript?
> Some code would be really great
>
> thanks
>
>
> Bill Marriott
> Analyst/Programmer
> Information Technology
> NSW Agriculture
> Orange
>
> Ph. 02 6391 3657
> Fax. 02 6391 3290
>
>
> This message is intended for the addressee named and may contain
> confidential information. If you are not the intended recipient or
> received it in error, please delete the message and notify sender. Views
> expressed are those of the individual sender and are not necessarily the
views of their organisation.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list