Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confirm Message Box 1

Status
Not open for further replies.

cm80

Technical User
May 3, 2001
85
US
HI, i need some help with a yes / no pop when a link is clicked..

i would like the user to be prompted with a message asking them if they are sure, and then redirect them to another page, if they are not sure don't redirect them..
 


<script language=&quot;javascript&quot;>
var clickok = window.confirm(&quot;This page will begin processing.\n Click OK to continue. Click Cancel to stop.&quot;);

if (clickok == false) { document.location=&quot;SomePage.asp&quot;;}
</script>


Fengshui1998
 
Since this is the VBScript forum, maybe the answer should be given in VBScript, so here's my version:

Code:
Dim bAnswer

bAnswer = MsgBox (&quot;Are you sure you want to do this?&quot;,  vbYesNo + vbQuestion + vbDefaultButton1, &quot;Leave me now?&quot;)   'yes/no buttons with question mark icon and default button of yes

If bAnswer = vbYes Then
    window.open or whatever
End If
 
Hi GlennBSI,
Thanks, that's a great help, but just to check... in the if statement do i have to have a statement for vbNO? and if yes do you know what if would be if I just wanted to return to the same page ie. pretty much like a cancel button
Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top