Forums

This topic is locked

How do I display message box if condition is met?

Posted 08 Oct 2001 20:48:18
1
has voted
08 Oct 2001 20:48:18 Kevin Abbott posted:
Hi there,

I want to display a message box and return null (stop the linked page from loading) only if a certain
condition is met.

Does anyone know how to do this?

Here's my code:

<%@LANGUAGE="JAVASCRIPT"%>
<%
Session("svPFN" = String(Request.Form("ProjectFileName");
if(Session("svPFN"=="undefined"{
Session("svPFN" = "None";}
// *** Logout the current user.
MM_Logout = String(Request.ServerVariables("URL") + "?MM_Logoutnow=1";
if (String(Request("MM_Logoutnow")=="1" {
Session.Abandon();
var MM_logoutRedirectPage = "../../default.asp";
// redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage == "" MM_logoutRedirectPage = String(Request.ServerVariables("URL");
if (String(MM_logoutRedirectPage).indexOf("?" == -1 && Request.QueryString != "" {
var MM_newQS = "?";
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
if (String(items.item()) != "MM_Logoutnow" {
if (MM_newQS.length > 1) MM_newQS += "&";
MM_newQS += items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
if (MM_newQS.length > 1) MM_logoutRedirectPage += MM_newQS;
}
Response.Redirect(MM_logoutRedirectPage);
}
%>
<!--#include file="../../Connections/projectstore.asp" -->
<%
var rsGreeting__MMColParam = "1";
if(String(Session("MM_Username") != "undefined" {
rsGreeting__MMColParam = String(Session("MM_Username");
}
%>
<%
var rsGreeting = Server.CreateObject("ADODB.Recordset";
rsGreeting.ActiveConnection = MM_projectstore_STRING;
rsGreeting.Source = "SELECT fnGreeting FROM tblAccess WHERE fnUser = '"+ rsGreeting__MMColParam.replace(/'/g,
"''" + "'";
rsGreeting.CursorType = 0;
rsGreeting.CursorLocation = 2;
rsGreeting.LockType = 3;
rsGreeting.Open();
var rsGreeting_numRows = 0;

var MyDate = Date();
%>

Heres the button I want the code to work with:

<a href="software/software.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('SoftRoll','','../../images/navibar/softbutover.gif','TextBar','','../../images/navibar/softtext.gif',1)"><img
name="SoftRoll" border="0" src="../../images/navibar/softbut.gif" width="100" height="30">

As you've probably guessed its a roll over button.

The object I want to use is Session("svPFN". If this object is set to "None" I DON'T want the user
to be able to go to software/software.asp, and also have the message box appear.

Any help would greatly appriciated, thanks.

Reply to this topic