Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 23rd, 2006, 06:05 PM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default For Loop Not incrementing

Why is my for loop not incrementing?

I declare the variable i to equal 2, and for testing I have an aleart box popup with the value at i, which is equal to 2, then after the for loop I have another alert box which is equal to i, which should be 4 but is 2 instead. This means my for loop is not incrementing. What did I do wrong?

        var i = 2;

            alert("Test: " + i);
        for (i = 2; i > 4; i++);
        {
            TFor="Tab" + i;
            BFor="Body" + i;
                       //i = i + 1;
        }
        alert("Test: " + i);

thanks,
Donrafeal7

Reply With Quote
  #2 (permalink)  
Old October 24th, 2006, 12:24 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kaos_frack
Default

the problem is on this line:
Code:
for (i = 2; i > 4; i++);
i'm sure you wanted to write
Code:
i < 4
instead of
Code:
i > 4
and also you mustn't have a semicolon after the closing brace
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incrementing attribute value Pankaj C XSLT 4 October 31st, 2007 05:40 AM
reading and incrementing a value phantom3008 ASP.NET 1.0 and 1.1 Basics 0 April 18th, 2007 10:29 AM
XSL Loop and incrementing a variable 2007-03-29 XSLT 8 March 30th, 2007 10:41 AM
Incrementing a value within a template Tre XSLT 1 March 21st, 2007 09:31 AM
incrementing javascript loop use i++ or ++i crmpicco Javascript How-To 4 May 11th, 2006 01:39 AM



All times are GMT -4. The time now is 04:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.