p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: msgbox/return problem


Message #1 by Sander Baaij <sbaaij@i...> on Tue, 28 Mar 2000 09:21:41 +0200
sander,
try this:

<html>
<body>
<script language="vbscript">
<!--
SUB alertlogout()
	Dim valMsg
	valMsg = MsgBox ("Check out wholesale prices. Are you Sure?", 36)
	'yes = 6, no = 7
	IF valMsg = "6" THEN
		top.location.href = "http://evertek.com"
	ELSE
		top.location.href = "http://wholesaleauction.com"
	END IF
END SUB
-->
</script>


<button onClick=alertlogout()>TEST</button>

</body>
</html>

Mehul Harry
Software Developer
http://www.evertek.com

> -----Original Message-----
> From: Sander Baaij [mailto:sbaaij@i...]
> Sent: Monday, March 27, 2000 11:22 PM
> To: How To
> Subject: [proasp_howto] msgbox/return problem
>
>
>
>  Ok, I have a small programming problem. This one probably has a
>  super-simple solution, but I just don't know how.
>
>  The problem is this: I want to click on a link, it opens a
> messagebox with
>  2 options. when clicked on "yes" you proceed, when clicked on "no" the
>  action is cancelled.
>  I wanted to do this with vbscript (the messagebox or msgbox function is
>  only available in vbscript). But there is no "return" command in vbscript
>  to cancel the action. So I tried javascript. But jscript doesn't have a
>  proper "msgbox" function aside from "alert" (AFAIK).
>
>  Now I'm trying to get around the problem by using "window.location.href"
>  to completely bypass returning to the original hyperlink. but for some
>  reason this doesn't work.
>
>  Here's some code:
>
> <script language="vbscript">
> <!--
> SUB alertlogout()
> 	Dim valMsg
> 	valMsg = MsgBox ("If you proceed with this action, your
> login-session will be ended. Are you Sure?", 36)
> 	'yes = 6, no = 7
> 	IF valMsg = 6 THEN
> 		window.location.href = "Register.asp?Error=WatchOut"
> 	ELSE
> 		window.location.href = "Project.asp"
> 	END IF
> 	alert (valMsg)
> END SUB
> -->
> </script>
>
> <a href="Register.asp?Error=WatchOut" onClick=alertlogout()>Re-login</a>
>
> Thanks in advance,
>
> Sander Baaij
> Ikhaya Knowledge Integration
>
> ---
> You are currently subscribed to proasp_howto.


  Return to Index