Print Page | Close Window

’Variable not defined’ for banner

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=3939
Printed Date: 01 April 2026 at 11:38pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ’Variable not defined’ for banner
Posted By: alastc
Subject: ’Variable not defined’ for banner
Date Posted: 29 June 2003 at 4:36pm
Hi,

I'm trying to add a random banner to the forum, but I'm getting an error.

The script (from http://www.haneng.com/Lessons_2.asp - haneng.com ) works fine on it's own, but when I include it in the forum (V6.28, in the footer) I get an error.

If it is included in the footer as another include, I get:
"Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'LowestNumber'

/forum/banner.asp, line 3"

If I add it to the footer itself, I get the same thing (different line number, but same line of code).

The initial part of the script is:
<%
RANDOMIZE
LowestNumber = 1
HighestNumber = 6
RandomNumber = INT((HighestNumber-LowestNumber+1)*Rnd+LowestNumber)
SELECT CASE RandomNumber
CASE "1"%>

I'm sure it's something simple (I'm not a programmer), could anyone point me in the right direction?

Thanks in advance,

-Alastair



Replies:
Posted By: b_bonnett
Date Posted: 29 June 2003 at 5:39pm

Add the following to the top of the script:

'Declare variables needed
Dim LowestNumber, HighestNumber, RandomNumber

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: alastc
Date Posted: 30 June 2003 at 3:27pm
Thanks Blair, that worked perfectly

Dunno why it worked on its own, but not within other pages? I guess because of all the other variables going on.

Do I need to 'destroy' those varaibles afterwards?

Thanks,

-Alastair


Posted By: b_bonnett
Date Posted: 01 July 2003 at 4:24am

They had to be declared since all the pages are set to 'Option Explicit' - which requires you to do this. Obviously the rest of your pages aren't set to do this and so you don't have to declare them there.

No, you don't need to 'destroy' the variables afterwards.

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net