Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ’Variable not defined’ for banner
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

’Variable not defined’ for banner

 Post Reply Post Reply
Author
alastc View Drop Down
Newbie
Newbie


Joined: 04 April 2002
Location: United Kingdom
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote alastc Quote  Post ReplyReply Direct Link To This Post Topic: ’Variable not defined’ for banner
    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 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
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post 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, The Plane Gallery
Greetings From Christchurch
Back to Top
alastc View Drop Down
Newbie
Newbie


Joined: 04 April 2002
Location: United Kingdom
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote alastc Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post 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, The Plane Gallery
Greetings From Christchurch
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.