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

Select option in website?

hi
can anybody help me on <select> option in website
I have multiple option bar with multiple choices i want when i select one choice in one bar it show only related choices on another option bar. all other choices must be hidden
thanks...


Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3. <head>
  4. <title>options</title>
  5.  
  6. </head>
  7. <body>
  8.  
  9. <select>
  10. <option selected="selected" value="1">Make A Choice</option>
  11. <option value="2">Diploma</option>
  12. <option value="2">UG</option>
  13. <option value="2">PG</option>
  14. </select>
  15.  
  16. <select>
  17.  
  18. <option selected="selected" value="1">Make A Choice</option>
  19. <option value="2">BCA</option>
  20. <option value="2">MBA</option>
  21. <option value="2">MSC</option>
  22. <option value="2">BBA</option>
  23. <option value="2">BSC</option>
  24. <option value="2">ENGEENERING</option>
  25. <option value="2">MBBS</option>
  26. </select>
  27.  
  28.  
  29. </body>
  30. </html>
  31.  
  32.  
I want when i select UG from first option only related option like BCA,BBA,BSc only displayed on second option not all the option. and when i select PG only MBA.MSc and so on
Apr 5 '11 #1
2 2277
hey saurabh,

unfortuneatly the only way that i can think of how you can do what you have said is via using some form of dynamic language such as javascript, php, or coldfusion.

maybe you would yield more results if you tried posting this in the javascript / ajax / dhtml section of the forums.

good luck mate
May 11 '11 #2
This can be achieved by using JavaScript.

For example just give a function along with the select in first section like

Expand|Select|Wrap|Line Numbers
  1. <select name="optionone" onClick="checkoptiontwo()">
Write the JS like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. function checkoptiontwo()
  3. {
  4. if(document.getElementById("optionone").value==2)
  5. {
  6. document.getElementById("mbbs").disabled=true;
  7. }
  8. }
  9.  
Don't forget to give each option different names(eg: name="mbbs") like bca,mba,etc and also different values. This is not the exact code. But I think you will get an idea.
May 11 '11 #3

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

Similar topics

1
by: Michael Hoffmann | last post by:
Hello, As you might guess I am completely new to this language. Maybe I get some help here. I try to execute a user defined funciton from a select option in a document to read a file into an...
3
by: J. Muenchbourg | last post by:
I have an ASP admin script where I'm adding records, and I have a category that already has set name values hard-coded into a selct option pulldown, but if the user wants to create a new category...
4
by: Jeff Anderson | last post by:
Is there a style for a select option's "selected" color? For example: <HTML> <BODY> <FORM NAME="form1"> <SELECT NAME="mySelect" SIZE="7" style="background-color:red;"> <OPTION>Test 1...
4
by: Old Lady | last post by:
Hi, I need help! I have a SELECT/OPTION list. My goal is to have a TEXT input field in a form that is normally disabled, but it should become enabled when the user select one predefined OPTION....
11
by: Stefan Finzel | last post by:
Hi trying to remove one or all elements of select options fails for Pocket Internet Explorer. Is there a way to do this? if is_PIE { // this does not work on Pocket IE while (opt.length) {...
2
by: shagy | last post by:
Hi, I'm having a problem with a <select><option> which has white space in values... When I post the data I only get the first word (up to the white space). "Testing white space" becomes...
1
by: kirke | last post by:
I want to load textarea's value in drop-down box. In first page, such form is existed. <form name="form1" method="post" action="next.php"> <textarea name="dayList" Id = "dayList" cols=20...
1
by: aamirghanchi | last post by:
I guess, the visibility and display styles of an OPTION in a SELECT list cannot be changed through javascript. I wanted to make some options unavailable depending on a situation eg. <select>...
3
by: pravinnweb | last post by:
Hi i have select option in my page which works fine in firefox in which i mention specific width for select option when i clicked select list the option lengths are large the option area is expanded...
7
by: fsalvador | last post by:
Hi, I am trying to figure it out how to to hide in onmouseout the select options of a form. Below is the code I got so far. It isn't working. Please help. Thanks <!DOCTYPE HTML PUBLIC...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...

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.