473,788 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

not showing correct options in selectbox while creating it dynamically in opera

5 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. while (changedVal.options.length)
  2.     {
  3.         changedVal.remove(0);
  4.         changedVal.options[0] = null;
  5.     }
  6.     for (var i=1; i<=maxiVal; i++) 
  7.     {
  8.         if(i==DefVal)
  9.         {
  10.             optionName = new Option(i+defaultText, i, false, true);
  11.         }
  12.         else
  13.         {
  14.         optionName = new Option(i, i, false, false);
  15.         }
  16.         changedVal.options[changedVal.length] = optionName;
  17.     }
Oct 12 '07 #1
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
Oct 12 '07 #2
ramchml
5 New Member
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
Expand|Select|Wrap|Line Numbers
  1. function CalBasedMaxVal(selVal,changedVal,maxiVal,DefVal)
  2. {
  3. var CalBasedSelValue=selVal.selectedIndex+1;
  4. var defaultText = '-['+lang_text_ary['default']+']';
  5. var optionName;
  6. while (changedVal.options.length)
  7. {
  8. changedVal.remove(0);
  9. changedVal.options[0] = null;
  10. }
  11. for (var i=1; i<=maxiVal; i++) 
  12. {
  13. if(i==DefVal)
  14. {
  15. optionName = new Option(i+defaultText, i, false, true);
  16. }
  17. else
  18. {
  19. optionName = new Option(i, i, false, false);
  20. }
  21. changedVal.options[changedVal.length] = optionName;
  22. }
  23. }
Oct 12 '07 #3
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]
Oct 15 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
Merged duplicate threads. Please do not double post.
Oct 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2661
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
2
2732
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 =...
1
1499
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...
1
1965
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>
0
9656
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, 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...
0
9498
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,...
0
10364
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...
0
9967
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...
1
7517
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
6750
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
5398
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...
1
4069
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
3
2894
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.