473,472 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Big menu

Hello all,

i'm generating a select menu, with php/mysql. The menu contains country names.

My problem is that i have ~ 250 countries in one of these menu and i need from
6 to ten times this menu in a web page.

Is there any way for sharing the data between each menu? It should speed up
transfert and decrease size of the web page.

Thx

--
David

Jul 20 '05 #1
2 2415
david <pa*********@server.com> writes:
i'm generating a select menu, with php/mysql. The menu contains
country names.

My problem is that i have ~ 250 countries in one of these menu and i
need from 6 to ten times this menu in a web page.
Whoa. with 250 options in a select element, you might want to consider
other ways of choosing (not sure which would be better, though, 250
options is a lot).
Is there any way for sharing the data between each menu? It should speed up
transfert and decrease size of the web page.


Yes, but then your page will not work if Javascript is disabled.
---
<script type="text/javascript">
function copyOptions(idFrom,idTo) {
var from = document.getElementById(idFrom);
var to = document.getElementById(idTo);
// maybe add sanity check: does both exist and are select elements
to.length = 0;
for (var i=0;i<from.length;i++) {
var opt = from.options[i];
to.options[i]=new Option(opt.text,opt.value);
}
}

function init() {
copyOptions("countrySel1","countrySel2");
copyOptions("countrySel1","countrySel3");
copyOptions("countrySel1","countrySel4");
copyOptions("countrySel1","countrySel5");
copyOptions("countrySel1","countrySel6");
}
</script>
---
and
---
<body onload="init()">
... <select id="countrySel1"><option>x250...</select>
... <select id="countrySel2"></select>
... <select id="countrySel3"></select>
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
david <pa*********@server.com> writes:
i'm generating a select menu, with php/mysql. The menu contains
country names.

My problem is that i have ~ 250 countries in one of these menu and i
need from 6 to ten times this menu in a web page. Whoa. with 250 options in a select element, you might want to consider
other ways of choosing (not sure which would be better, though, 250
options is a lot).
well, a select your country menu is widely present on the web though...

Is there any way for sharing the data between each menu? It should speed up
transfert and decrease size of the web page.

Yes, but then your page will not work if Javascript is disabled.
that's already the case :(

---
<script type="text/javascript">
function copyOptions(idFrom,idTo) {
var from = document.getElementById(idFrom);
var to = document.getElementById(idTo);
// maybe add sanity check: does both exist and are select elements
to.length = 0;
for (var i=0;i<from.length;i++) {
var opt = from.options[i];
to.options[i]=new Option(opt.text,opt.value);
}
}

function init() {
copyOptions("countrySel1","countrySel2");
copyOptions("countrySel1","countrySel3");
copyOptions("countrySel1","countrySel4");
copyOptions("countrySel1","countrySel5");
copyOptions("countrySel1","countrySel6");
}
</script>
---
and
---
<body onload="init()">
... <select id="countrySel1"><option>x250...</select>
... <select id="countrySel2"></select>
... <select id="countrySel3"></select>
---


thx but with this, the size of the web page is smaller, but the HTML tree in
the browser memory ends up with the same size... it's not exactely what i
wanted but, i may use the trick later.

Thx again :)

--
David

Jul 20 '05 #3

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

Similar topics

1
by: Macamba | last post by:
Hi all, I am currently developing a website for a voluntary organisation. It is my first step in website development. The dynamic menu I developed has some bugs, which I addressed in another...
1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
1
by: Anthony | last post by:
Below is a script I found at http://javascript.internet.com/ for a cascading menu. The script works great but there is one thing that I would like modified. BecauseI am just learning javascript,...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
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...
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...
1
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...
0
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...
0
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 ...

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.