i have two select boxes.based on the selected value in one select box it show the maximum options in the other select box in next page.i used javascript onclick function.for first time it shows correct options in the second select box if i go back and change the value in the 1st select box it shows me the previous value in the 2nd select box,the value not get changed.it is happening only in opera9 all the other browsers its working fine.it seems that only for first time the function clears all the options in the selectbox for second time it is not clearing the options it just reload it. - while (changedVal.options.length)
-
{
-
changedVal.remove(0);
-
changedVal.options[0] = null;
-
}
-
for (var i=1; i<=maxiVal; i++)
-
{
-
if(i==DefVal)
-
{
-
optionName = new Option(i+defaultText, i, false, true);
-
}
-
else
-
{
-
optionName = new Option(i, i, false, false);
-
}
-
changedVal.options[changedVal.length] = optionName;
-
}
4 1424 gits 5,390
Recognized Expert Moderator Expert
hi ...
welcome to TSDN ...
i've moved your thread from the js articles-section to the forum for you ... please don't post questions to the articles sections ...
kind regards
opera9.23
i have two select boxes based on the selected value in one select box it should display the maximum options in the other select box.
i used java script onClick for the first time it displays correct values again when i go back and change the value in the 1st selectbox the 2nd select box display previous values only.it works in all the browsers except opera.
my code is - function CalBasedMaxVal(selVal,changedVal,maxiVal,DefVal)
-
{
-
var CalBasedSelValue=selVal.selectedIndex+1;
-
var defaultText = '-['+lang_text_ary['default']+']';
-
var optionName;
-
while (changedVal.options.length)
-
{
-
changedVal.remove(0);
-
changedVal.options[0] = null;
-
}
-
for (var i=1; i<=maxiVal; i++)
-
{
-
if(i==DefVal)
-
{
-
optionName = new Option(i+defaultText, i, false, true);
-
}
-
else
-
{
-
optionName = new Option(i, i, false, false);
-
}
-
changedVal.options[changedVal.length] = optionName;
-
}
-
}
acoder 16,027
Recognized Expert Moderator MVP
Have a look at this tutorial.
Please use code tags when posting code:
[CODE=javascrip t]
JavaScript code here.
[/code]
acoder 16,027
Recognized Expert Moderator MVP
Merged duplicate threads. Please do not double post.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Stefan Richter |
last post by:
I would like to fill a Selectbox dynamically.
I am taking all values from a db, and fill them into a selectbox.
I guess the best way was to use some kind of a dynamical array, where you
don't have to say how many
elements it will contain.
In Java there exists special containers to achieve that, but what about VB?
I thought about somethign like that:
select year from db
|
by: shankwheat |
last post by:
I have a form named 'choiceForm' and 2 select boxes named 'available'
and 'move'. I give users the ability of copying options (not moving)
from available to move with the code below. I would like to create a
button which copies all options from available to move but not sure how
to do this. Thanks for any help.
function moveOver()
{
var boxLength = document.choiceForm.move.length;
var selectedItem =...
|
by: swatipriyadarsani |
last post by:
hi!!! i m creating website ...i m using ajax.When the page loads..there are 2 combo box one for state and other for city.on select of state city will get populated and on select of city my age will dynamically generate textbox along with combo box.This dynamically generated textbox will contain all the pincode for a particular selected city. and the combo box will contain all the username .
My problem starts here...
1.Once i click on save...
|
by: giloosh |
last post by:
i would like to dynamically output such a selectbox below using php
and mysql:
<select>
<option< 100 </option>
<option100 to 150 </option>
<option150 to 200 </option>
<option200 to 250 </option>
<option250 to 300</option>
<option 300 </option>
</select>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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: 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: 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();...
|
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...
| |
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
|
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...
| |