Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2004, 02:25 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default You Want Infuriating? I'll Show You Infuriating!

As you can see, I've been having problems with the mwcatering web page that I have been working on for my Intro to Javascript class. This is how I have the banner cycle code laid out:

Code:
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Hide from old browsers
    var banners = new Array("banner1.jpg","banner2.jpg","banner3.jpg","banner4.jpg")
    var bnrCntr = 0
    function bancycle()
            {
            bnrCntr = bnrCntr + 1
            if (bnrCntr == 4)

               bnrCntr = 0
            }
            document.Banner.src = banners[bnrCntr]
            setTimeout("bancycle()",3000)
          }

//-->                 
</SCRIPT>
I did it this way at the suggestion of my instructor but I'm getting the error message saying that bancycle is not defined. I'm using Firefox to test the page, BTW.

Ben Horne
-------------------------
I don't want to sound like I haven't made any mistakes. I'm confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
__________________
Ben Horne
-------------------------
I don\'t want to sound like I haven\'t made any mistakes. I\'m confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
 
Old November 22nd, 2004, 04:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Please be more specific with your subjects. This makes it much easier to determine whether a message is worth reading / answering or not for your fellow P2P members.

A topic like "Problem with setTimeout method" or "IE only code refuses to work in Firefox" really makes things much easier for everyone.

Besides that, it wasn't an original subject anyway ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: I Could Have Lied by Red Hot Chili Peppers (Track 6 from the album: Blood Sugar ************ Magik) What's This?
 
Old November 22nd, 2004, 04:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think you've missed a bracket, and a few semicolons try :

Code:
    function bancycle()
    {       bnrCntr = bnrCntr + 1;
            if (bnrCntr == 4)
            {     
               bnrCntr = 0;
            }
            document.Banner.src = banners[bnrCntr];
            setTimeout("bancycle()",3000);
    }
I assume that you are setting the initial value of bnrCntr elsewhere ?





Similar Threads
Thread Thread Starter Forum Replies Last Post
messagebox.show bikki_suresh ASP.NET 1.0 and 1.1 Basics 3 March 20th, 2008 04:26 AM
You Want Infuriating? I'll Show You Infuriating! Ben Horne Javascript 1 November 1st, 2004 04:34 PM
Show WebForm johanyu ASP.NET 1.0 and 1.1 Basics 5 October 14th, 2004 01:07 AM
SHOW THE BOX yami56 Javascript 4 July 12th, 2004 11:18 PM
How to show picture phoenixcu Access 1 June 10th, 2003 11:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.