473,378 Members | 1,344 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,378 software developers and data experts.

Help select

Hello,
I have definited two select: main, secondary

main = 0, 1, 2

secondaryA = "a", "b", "c"
secondaryB = "1", "2", "3"
secondaryC = "5", "6", "15", "25"

i want that, if i check from first select (main) the value 0, in secondary
select, will be displayed the value from secondaryA; if i set value 1, in
secondaty, will be displayed: secondaryB etc etc... shortly:

select 1 select 2
main(1) ==> secondaryA
main(2) ==> secondaryB
main(3) ==> secondaryC
who help me, for solve this problem?
thanks you, cooper.
PS: Sorry for my english
Jul 20 '05 #1
1 3916
Something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
secondaryA = new Array("a", "b", "c");
secondaryB = new Array("1", "2", "3");
secondaryC = new Array("5", "6", "15", "25");

function main_changed(){
var obj = document.getElementById("main");
var selectedValue = obj.options[obj.options.selectedIndex].value;
var temp;
switch (selectedValue){
case "1":
temp = secondaryA;
break;
case "2":
temp = secondaryB;
break;
case "3":
temp = secondaryC;
break;
}
displaySecondary(temp);
}

function displaySecondary(whichArray){
var obj = document.getElementById("secondary");
deleteOptions(obj);
for (var i = 0; i<whichArray.length; i++){
var objOption = document.createElement("OPTION");
obj.appendChild(objOption);
objOption.value = i;
var newText = document.createTextNode(whichArray[i]);
objOption.appendChild(newText);
}
}

function deleteOptions(obj){
var l = obj.options.length;
for (var i=0; i<l; i++){
obj.options[0].removeNode(true);
}
}

//-->
</script>
</head>

<body>
<select id="main" onchange="main_changed();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="secondary"></select>
<script language="JavaScript" type="text/javascript">
<!--
displaySecondary(secondaryA);
//-->
</script>

</body>
</html>
"Cooper" <co****@blueware.it> wrote in message
news:U1**********************@news1.tin.it...
Hello,
I have definited two select: main, secondary

main = 0, 1, 2

secondaryA = "a", "b", "c"
secondaryB = "1", "2", "3"
secondaryC = "5", "6", "15", "25"

i want that, if i check from first select (main) the value 0, in secondary
select, will be displayed the value from secondaryA; if i set value 1, in
secondaty, will be displayed: secondaryB etc etc... shortly:

select 1 select 2
main(1) ==> secondaryA
main(2) ==> secondaryB
main(3) ==> secondaryC
who help me, for solve this problem?
thanks you, cooper.
PS: Sorry for my english

Jul 20 '05 #2

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

Similar topics

1
by: Hunter | last post by:
Hi group - I'm using php to extract data from postgres and print to browser. I have data that was input through checkboxes on a form - each checkbox had a different value but got pushed into the...
4
by: Neeper | last post by:
Hi, I've got a transactions table with a tstamp field (datetime type) and I need help creating a SELECT query to retrieve only last transactions that occured within the last 5 minutes. The...
1
by: Pieter Linden | last post by:
Hi, I think the subject line pretty much says it all... Say I have a students-classes database and I add a twist. I want to filter what courses a student can take by comparing the courses he...
2
by: Chris | last post by:
Hello all, I'm having some trouble setting up a query. Background: The table TBLSCREEN stores data about screenings of patients/subjects for eligibility to participate in a health study. A...
0
by: Josha | last post by:
How can a select command be limited to only select text existing as allcaps? It is a word document.
1
by: bpforte | last post by:
Hello, I need help with building query, basically I need to select all records from one table that don't exists in second table with status 1, but they can exists in second table with status 0, to...
5
by: Reshmi Jacob | last post by:
Hello Can I have more than one variable assign to a select clause in a trigger. How? My stmt creates an error SELECT FLD1 into VAR1, FLD2 into VAR2 FROM MYTABLE; ERROR shown at the second...
4
by: Matt Pegg | last post by:
Hi all, This I thought would be a relatively easy question, but after hunting around the net, I haven't been able to source an answer.. I have a large table in Access with four fields. I...
0
by: New2ASP | last post by:
Thanks everyone in advance for your help. I am fairly new to web development but an experienced window-based developer. Here's the structure of my Gridview Column 1 : Checkbox with SelectAll...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.