473,699 Members | 2,464 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 1429
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
2935
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
1168
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
2106
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, it's not really the same language as CPython is today. You still have to type "from __future__...
10
2798
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 pathname 124
14
1531
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
1229
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
1270
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 few months out of new developments to go back and fix a bunch of things (like this), and I was...
32
2590
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 seem to do that in .net. I this functionality available?
1
1479
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); // draw it x=x+50; //change x to move next square along }
0
9184
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8931
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8892
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7767
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6539
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5878
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2014
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.