Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 24th, 2004, 11:22 PM
Authorized User
 
Join Date: Oct 2003
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with this confirm alert script, Please!

My question is below, but I found the answer so I wanted to post this so no one would waste their time responding. For those that might need the answer some day, here is how you do it:

<script language="javascript">
if (confirm("blah, blah, blah!"))
{
window.location.href="http://www.whatever.com/your_page_name_here.htm";
}
else
{
window.close();
}
</script>


The first part of this script does what I want and that is go to the link shown, but the "else" statement, I just want the page to close when the user clickes the Cancel button.

<script language="javascript">

if(confirm("blah,blah,blah!"))
{
window.location.href="http://www.whatever.com/my_page_here.htm";
}
else
{
window.location.href=""; <--- Here, I just want the entire window to close when they click the Cancel button.
}
</script>



Would you be so kind as to provide the sytax code to do this? I am stumped. :)
__________________
Rudy
 
Old January 26th, 2004, 02:42 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Cross post to this page

Snib





Similar Threads
Thread Thread Starter Forum Replies Last Post
Confirm messagebox edwin.debrouwere ASP.NET 2.0 Basics 0 September 5th, 2006 07:29 AM
change this alert/confirm box crmpicco Javascript How-To 3 March 9th, 2005 01:11 PM
confirm crmpicco Javascript How-To 2 February 7th, 2005 01:23 PM
HTML Confirm VSnewbie Javascript How-To 3 August 30th, 2004 10:36 AM
Confirm alert box - need help, Please! larry HTML Code Clinic 1 January 25th, 2004 02:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.