HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
two dropdown menus :roll:
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
Yahya2004



Joined: 03 Nov 2004
Posts: 3

PostPosted: Wed Nov 03, 2004 7:03 pm     two dropdown menus :roll: Reply with quote

hi all,

i am new in HTML and building a simple html page.

i have a problem ...

i made two dropdown menus but how i connect them together..

the picture is:

the first dropdown active ant the second not active,
then when i choose the first option in the first dropdown menu the next dropdown menu activate and it loads the list of the first option in the first dropdown menu.

i would like to do this... but how?? Rolling Eyes
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8255
Location: Castle Rock CO USA

PostPosted: Thu Nov 04, 2004 5:50 am     Reply with quote



You can use JavaScript. In the <HEAD>:
Code:
<script language="JAVASCRIPT">
var browser_type=navigator.appName

var employerArray = new Array("General Information", "Enrollment Services", "Flexible Benefits", "Commuter Choice Program", "COBRA Administration", "Invoice Reconciliation", "Voluntary Benefits", "Payroll Deduction Benefits", "MasterCash ATM Card" , "User Name / Password Problems")
var employeeArray = new Array("General Information", "Flex Plan", "Commuter Choice Plan","Enrollment Services", "COBRA Administration", "Pending Notifications", "Specific Expenses", "MasterCash ATM Card", "User Name / Password Problems")
var brokerArray = new Array("General Information", "Flex Plan", "Commuter Choice Plan",  "Section 125 Plan" ,  "Commuter / Transit" , "COBRA Administration", "MasterCash ATM Card", "Voluntary Benefits", "Other")
var otherArray = new Array("Other")

function updateList(theForm, catName, subjListLength){
    for (var i=subjListLength + 1 ; i > 0 ; i-- )
    {
   theForm.Subject.options[i] = null
    }
   if( catName == "None"){
      var option0 = new Option("- Please Choose a Category Above -", "None")
   }
   else{
      eval('var option0 = new Option("- Please Choose -", "None")')
   }
   
    NSL=0
    if (catName != "None") {
       eval("var NewSource = " + catName +"Array")
       NSL = NewSource.length
           for(var L = 0; L < NSL + 1; L++)  {
       eval("var option" + [L + 1] + " = new Option(" + '"' + NewSource[L] + '", "' + NewSource[L] + '")')
          }
    }
    for (var i=0; i < NSL + 1; i++) {
         eval("theForm.Subject.options[i]=option" + i)
        if (i==0) {
      theForm.Subject.options[i].selected=true
        }
    }
if (browser_type=="Netscape")
   { history.go(0) }
}
</script>

And then in the <BODY>
Code:
                      <select name="Category" size="1" onChange="updateList(this.form, this.options[selectedIndex].value, this.form.Subject.length)">
                        <option value="None"  Selected >- Please Choose - </option>
                        <option value="employer" >Employer </option>
                        <option value="employee" >Employee </option>
                        <option value="broker" >Broker </option>
                        <option value="other" >Other </option>
                      </select>
                      <select name="Subject" id="Subject">
                        <option value="None" SELECTED>- Please Choose a Category  Above - </option>
                      </select>
Yahya2004



Joined: 03 Nov 2004
Posts: 3

PostPosted: Thu Nov 04, 2004 9:25 am     Reply with quote

hi Corey Bryant,

thanks for that solution i am already trying it Wink

many many thanks to u Smile
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial