473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.getElementById('m'+x).style.display='none '; // Closes the menu-chain
Next x
document.getElementById(list).style.display='block '; // Opens the menu-chain by name
}
Many thanks

Paul
Jul 23 '05 #1
2 1419
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.getElementById('m'+x).style.display='none '; // Closes the menu-chain
Next x
document.getElementById(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.getElementById('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
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 ...
8
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
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...
10
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"...
14
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 ...
1
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...
1
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....
32
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.