Tweet
If you work a lot with ASP and get data from databases, you might have been in need of creating different CSS rules for each item in a recordset.
We can create dynamic CSS rules with a simple loop, assuming we know the number of items to which we will apply the rule. The point is that we don't know how many recordset items we will get from the database, but we can create rules according to different situation, as I will explain shortly.
Now follow me and see what we can do.
Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts
Wednesday, 11 April 2012
Wednesday, 27 April 2011
VBScript & ASP: loops!
Tweet
Everybody uses looping functions with VBScript, however do we know how many possible variant there are? How many statements? Ok, now close your eyes and count them. How many statements can you remember?
The looping statements are used to repeat a block of code for a predetermined number of times. There are 4 statements to do so:
1) For ... Next - the code is run a number of times;
2) For Each ... Next - the code is run for each item in a collection;
3) Do ... Loop - the code is run until a condition is met;
4) While ... Wend - the same as Do ... Loop.
Everybody uses looping functions with VBScript, however do we know how many possible variant there are? How many statements? Ok, now close your eyes and count them. How many statements can you remember?
The looping statements are used to repeat a block of code for a predetermined number of times. There are 4 statements to do so:
1) For ... Next - the code is run a number of times;
2) For Each ... Next - the code is run for each item in a collection;
3) Do ... Loop - the code is run until a condition is met;
4) While ... Wend - the same as Do ... Loop.
Subscribe to:
Posts (Atom)