473,560 Members | 2,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to do a For x=1 to 10 kinda loop

Hi Everybody,

I've adapted a tutorial to make my own navigation menu.
Its an "Expanding/Contracting" kind of menu that looks
neat and simple and a toggle to "Expand/Contract" any
of the menu-chains works fine...
Problem is... I need to control "when" any of the menus
is in an "Expand/Contract" mode. Otherwise, a menu script
isn't worth diddly.

I thought... Contract them all, and then just Expand the
single one I want to.

This would be the pseudo-script. Will someone help me
javascript it? I really don't understand javascripts For logic.

I've named the ID for each menu-chain "m1", "m2", "m3"
so that I could do this loop
Function MainMenu(list)
{
FOR x = 1 to 15
document.getEle mentById('m'+x) .style.display= 'none'; // Closes the menu-chain
Next x
document.getEle mentById(list). style.display=' block'; // Opens the menu-chain by name
}
Many thanks

Paul
Jul 23 '05 #1
2 1425
Paul Bruneau wrote:
Hi Everybody,

I've adapted a tutorial to make my own navigation menu.
Its an "Expanding/Contracting" kind of menu that looks
neat and simple and a toggle to "Expand/Contract" any
of the menu-chains works fine...
Problem is... I need to control "when" any of the menus
is in an "Expand/Contract" mode. Otherwise, a menu script
isn't worth diddly.

I thought... Contract them all, and then just Expand the
single one I want to.

This would be the pseudo-script. Will someone help me
javascript it? I really don't understand javascripts For logic.

I've named the ID for each menu-chain "m1", "m2", "m3"
so that I could do this loop
Function MainMenu(list) {
FOR x = 1 to 15
document.getEle mentById('m'+x) .style.display= 'none'; // Closes the menu-chain
Next x
document.getEle mentById(list). style.display=' block'; // Opens the menu-chain by name
}
Many thanks
Paul


http://www.w3schools.com/js/js_looping.asp

for

The for statement will execute a block of code a specified number of times

for (initialization ; condition; increment)
{
code to be executed
}

for (var x=1; x<16; x++){
document.getEle mentById('m'+x) .style.display= 'none';
}

Mike

Jul 23 '05 #2
Thanks Mike,

That snippet was a cool way to express the step.

Thank you for the help

Paul
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2925
by: Charles Alexander | last post by:
Hello I am new to php & MySQL - I am trying to retrieve some records from a MySQL table and redisplay them. The data in list form looks like this: Sample_ID Marker_ID Variation G23_NA17192.fsa rs7374540 A/C I23_Control.fsa rs7374540 C/C
8
1164
by: ChocoboMog123 | last post by:
What's wrong with line 8 in this code? x=1 while 1==1: x=x+1 y=range(1,x) z=0 q=9 for count in y: q=x%y if q==0:
6
2102
by: Dave Benjamin | last post by:
Hey good people, I've been doing a lot of simultaneous Jython and CPython programming lately, and just wanted to say, with no intended ill will toward any of the individuals who have been generous enough to make the two languages possible, that, well, they're kinda different. I guess it was inevitable, but with Jython stuck at Python 2.1,...
10
2789
by: David P. Jessup | last post by:
Lets see if I can explain this so I can get a good answer =) I'm trying to speed up a file search via FSO. I have a database that contains the exact path where files can be found and an "index" number assigned to each file. This index number is part of each files name. Example: DB columns filepath flindex pathname 123...
14
1524
by: Abby Lee | last post by:
1st sorry about leangth...couldn't really cut anymore. I want the output to be Organization 320000 Fund 100004 Program 777777 Account1 7234.55 Account2 -347.99 Account3 823.55
1
1224
by: Kelvin | last post by:
hi everyone... i discover this accentally when i was debugging a program... here is the problem( or maybe not :) ) *************CODE******************* #include <iostream> using namespace std; int main(){ int i = 0;
1
1265
by: Tim Feeley | last post by:
Hey guys, I currently have a giant client editor form in ASP/SQL. The form is fine. The problem is that there are several sub-forms that store their data in other tables. Which gets cluttered. For example, I can't let users add data in these sub-forms until the main form is completed and an autonumbered ID is generated. We're taking a...
32
2565
by: cj | last post by:
When I'm inside a do while loop sometimes it's necessary to jump out of the loop using exit do. I'm also used to being able to jump back and begin the loop again. Not sure which language my memories are of but I think I just said loop somewhere inside the loop and it immediately jumped back to the start of the loop and began again. I can't...
1
1474
by: Narutodono | last post by:
for (int i=0; i<5; i++) // for loop for creating a background of tiles { x=10; Graphics g = canvas.getGraphics(); // call Tile to draw a tile Tile tile = new Tile; // intialise tile tile = new Tile(1,x,y); // a new tile for every i tile.Draw(g); //...
0
7552
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7841
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8066
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6191
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5458
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5175
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2047
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.