Hi all,
I am newcomer in HTML, Javascript,
I want to create two select controls S1, S2.
There are 3 options: ALL, A, B in S1;
When select A in S1, It let you select A1, A2 in S2,
Where select B in S1, It let you select B1, B2 in S2;
When select ALL in S1, It let you select A1, A2, B1, B2 in S2
The default selection in S1 is ALL,
Can somebody give me some suggestion?
Thanks advance
Carl 1 5524
Carl Wu wrote: I want to create two select controls S1, S2.
<select name="S1">
</select>
<select name="S2">
</select>
There are 3 options: ALL, A, B in S1;
<select name="S1">
<option>ALL</option>
<option>A</option>
<option>B</option>
</select>
When select A in S1, It let you select A1, A2 in S2,
Where select B in S1, It let you select B1, B2 in S2;
When select ALL in S1, It let you select A1, A2, B1, B2 in S2
<script type="text/javascript" language="JavaS cript">
<!--
function enableItems(o)
{
if (!o || !o.form || !o.form.element s)
return false;
var
o2 = o.form.elements['S2'],
a1 = o2.options[0],
a2 = o2.options[1],
b1 = o2.options[2],
b2 = o2.options[3];
if (o2 && a1 && typeof a1.disabled != "undefined" )
{
switch (o.selectedInde x)
{
case 0: // ALL
a1.disabled = false;
if (a2)
a2.disabled = false;
if (b1)
b1.disabled = false;
if (b2)
b2.disabled = false;
break;
case 1: // A
a1.disabled = false;
if (a2)
a2.disabled = false;
break;
case 2: // B
if (b1)
b1.disabled = false;
if (b2)
b2.disabled = false;
}
}
}
//-->
</script>
<form action="...">
<select name="S1" onchange="enabl eItems(this)">
<option>ALL</option>
<option>A</option>
<option>B</option>
</select>
<select name="S2">
<option>A1</option>
<option>A2</option>
<option>B1</option>
<option>B2</option>
</select>
</form>
Untested.
The default selection in S1 is ALL,
It is the default because it is the first item.
Can somebody give me some suggestion?
See above. And before you post to a newsgroup the next time, you should get
a minimum clue of what you are doing (by reading documentations, FAQS aso.)
This is not a support forum but a discussion group.
PointedEars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: headware |
last post by:
I have a <select> control that contains many entries. It allows the
user to multi-select a group of them, click a button, and store the
selected data in a database. Normally they do this starting at the top
of the list moving down towards the bottom. The problem I was having
was that the <select> control was scrolling back to the top of the
page after the postback and the user would lose their place in the
<select> control forcing them to...
|
by: relaxedrob |
last post by:
Hi All,
I want to write a select control and use a Javascript function to
handle all click events on the control. Under certain circumstances I
also wish to prevent the dropdown's list from being rendered.
Here is a sample showing what I am _unsuccessfully_ trying to do. :-/
<html>
<head>
|
by: jascraig |
last post by:
Here's my dilemma. I'm working with a frameset with 3 frames
(header,content,control). My control frame contains a select list with
buttons for next and previous. When the next button is pushed the
select list moves to the next option and the content frame changes to
the next URL, and a page number is updated on the header. The code I
have now works great on NS 7 and FF1. When I test it in IE, the select
box updates then immediately...
|
by: larry |
last post by:
Hi,
I am a newbie to Internet programming. I have some questions about
spacing in HTML control names and subsequently being able to access
these input elements in JavaScript If you don't have time to read the
whole message, the main question is can HTML form names have spaces in
them and if so what is the syntax for accessing them using Javascript
I have a Perl script which dynamically creates html and ultimately
generates a form. ...
|
by: Allan M. |
last post by:
I have a series of select boxes that must be populated
client side, because they interact with each other. The
design specification calls for these boxes to be updated
without having to make a roundtrip to the server.
The codebehind seems to be unaware of select box members
populated via javascript. So, I'm having to create my own
state management solution, (i.e. rewriting the VIEWSTATE
mechanism) to persist the state of these select...
| |
by: Mad Scientist Jr |
last post by:
I'm stuck trying to work with a HTML <SELECT> control and javascript
(similar to DualList but that control doesn't offer enough options to
totally control the text on the buttons and control, also I don't have
c# on this machine to try and modify it).. anyway...
I'm trying to get javascipt to select all items in a <SELECT> control
and submit the form to an asp.net page. For some reason when the link
is clicked, you can see the items all...
|
by: Chris Fink |
last post by:
Does anyone know it is possible to include a small image(.gif .jpeg)
within a <SELECT><option> so that the user would see the option text as
well as a little image(icon) in the option? I know this is not an ASP.NET
related question, but I know this group is knowledgeable and quick with
responses.
Thanks
|
by: frank.sconzo |
last post by:
Greetings,
I was testing my web application on the Mac/Safari and noticed a
problem with the background color of the select input element.
Safari doesn't seem to pay any attention to the style I set for the
background color. The listbox ends up with a white background.
It works nicely in Internet Explorer and I would like to make it work
on Safari too.
Perhaps I am doing something slightly non-standard, or maybe there is a
|
by: simon.wilkinson |
last post by:
Hi,
I am trying to update all Select boxes on a page dynamically using
javascript, I simple want to change the selected item in each select
box when a tick box is pressed on the page. Each Select box is named
in the same convention ie. ddl_DeliveryStatus_ and then the recordID
and contains the same options in the same order. The number of select
boxes changes every time the page is loaded as this is all built using
ASP linked to a...
|
by: andypb123 |
last post by:
Hello,
The onchange event fires in IE6 in a SELECT element when scrolling
through the list with the up and down arrows on the keyboard. In
Firefox it only fires after you hit the enter key, which is the
behaviour I want make happen in IE.
Does anyone know how to accomplish this?
Thanks a lot
Andy Birchall
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |