JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 18th, 2009, 04:22 PM
lemster29 lemster29 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 1 lemster29 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 4 sec
Reputation Power: 0
Red face Dual Drop Down

I have a script that is a double drop down menu. One side is year - other is months. My problem is. I have to reset the year every time I want to change months. I would like to be able to select say year 2009 and then choose jan - feb etc or the same for 2010 and 2011 etc. Can anyone tell me how to do this.

Here is the script I have


<script language="javascript">

<!--//

//new Option("text","value")

//this code changes menus







function nullOptionsDMA(aMenu){

var tot=aMenu.options.length

for (i=0;i<tot;i++)

{

aMenu.options[i]=null

}

aMenu.options.length=0;

}



function MySubjectDMA0(aMenu){

nullOptionsDMA(aMenu)



with (aMenu){



//Rewrites the text and values

options[0]=new Option("Select a page","none");

options[1]=new Option("January","9jan.html");

options[2]=new Option("Feburay","9feb.html");

options[3]=new Option("March","9mar.html");

options[4]=new Option("April","9apr.html");

options[5]=new Option("May","9may.html");

options[6]=new Option("June","9jun.html");

options[7]=new Option("July","9jul.html");

options[8]=new Option("August","9aug.html");

options[9]=new Option("September","9sep.html");

options[10]=new Option("October","9oct.html");

options[11]=new Option("November","9nov.html");

options[12]=new Option("December","9dec.html");

options[0].selected=true





}

}

function MySubjectDMA1(aMenu){

nullOptionsDMA(aMenu)



with (aMenu){



//Rewrites the text and values

options[0]=new Option("Select a page","none");

options[1]=new Option("January","0jan.html");

options[2]=new Option("Feburay","0feb.html");

options[3]=new Option("March","0mar.html");

options[4]=new Option("April","0apr.html");

options[5]=new Option("May","0may.html");

options[6]=new Option("June","0jun.html");

options[7]=new Option("July","0jul.html");

options[8]=new Option("August","0aug.html");

options[9]=new Option("September","0sep.html");

options[10]=new Option("October","0oct.html");

options[11]=new Option("November","0nov.html");

options[12]=new Option("December","0dec.html");

options[0].selected=true





}

}

function MySubjectDMA2(aMenu){

nullOptionsDMA(aMenu)



with (aMenu){



//Rewrites the text and values

options[0]=new Option("Select a page","none");

options[1]=new Option("January","11/jan.html");

options[2]=new Option("Feburay","11/feb.html");

options[3]=new Option("March","11/mar.html");

options[4]=new Option("April","11/apr.html");

options[5]=new Option("May","11/may.html");

options[6]=new Option("June","11/jun.html");

options[7]=new Option("July","11/jul.html");

options[8]=new Option("August","11/aug.html");

options[9]=new Option("September","11/sep.html");

options[10]=new Option("October","11/oct.html");

options[11]=new Option("November","11/nov.html");

options[12]=new Option("December","11/dec.html");

options[0].selected=true





}

}

function MySubjectDMA3(aMenu){

nullOptionsDMA(aMenu)



with (aMenu){



//Rewrites the text and values

options[0]=new Option("Select a page","none");

options[1]=new Option("9January","12/jan.html");

options[2]=new Option("Feburay","12/feb.html");

options[3]=new Option("March","12/mar.html");

options[4]=new Option("April","12/apr.html");

options[5]=new Option("May","12/may.html");

options[6]=new Option("June","12/jun.html");

options[7]=new Option("July","12/jul.html");

options[8]=new Option("August","12/aug.html");

options[9]=new Option("September","12/sep.html");

options[10]=new Option("October","12/oct.html");

options[11]=new Option("November","12/nov.html");

options[12]=new Option("December","12/dec.html");

options[0].selected=true





}

}

/* ####################### goDM() ####################### */



function goDMA(aMenu){

if (aMenu.options.value!="none")

{

location=aMenu.options[aMenu.selectedIndex].value

}



}



/* ####################### setUp ####################### */



function setUpDMA(){

with (document.formDoubleMenuDMA) {

if (menuSubjectsDMA.selectedIndex==0){

menuSubjectsDMA.options[0].selected=true

menuFilesDMA.options[0].selected=true

}



if (menuSubjectsDMA.selectedIndex==1)

MySubjectDMA0(menuFilesDMA)

if (menuSubjectsDMA.selectedIndex==2)

MySubjectDMA1(menuFilesDMA)

if (menuSubjectsDMA.selectedIndex==3)

MySubjectDMA2(menuFilesDMA)

if (menuSubjectsDMA.selectedIndex==4)

MySubjectDMA3(menuFilesDMA)



}

}



/* ####################### changeFiles ####################### */



function changeFilesDMA(){

aMenu=document.formDoubleMenuDMA.menuSubjectsDMA

aMenu2=document.formDoubleMenuDMA.menuFilesDMA

with (aMenu){



switch (selectedIndex) {

case 0:

aMenu2.options.length=0;

aMenu2.options[0]=

new Option("Pages appear here","none")

aMenu2.options[0].selected=true;

history.go(0)

break

case 1:

MySubjectDMA0(aMenu2)

aMenu2.options[0].text="Month"

break

case 2:

MySubjectDMA1(aMenu2)

aMenu2.options[0].text="Month"

break

case 3:

MySubjectDMA2(aMenu2)

aMenu2.options[0].text="Month"

break

case 4:

MySubjectDMA3(aMenu2)

aMenu2.options[0].text="Month"

break



}

}



}

//-->

</script>






<body>





<form name="formDoubleMenuDMA" >



<p>



<!-- This menu holds the subjects-->

<select name="menuSubjectsDMA" onChange="changeFilesDMA()">

<option value="none" >Year

<option value="">2009

<option value="">2010

<option value="">2011

<option value="">2012

</select>

<!-- this menu holds the files to go-->

<select name="menuFilesDMA" onChange="goDMA(this)" style="width:80">

<option value="none"> Month







</select>







<p>



</form>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Dual Drop Down


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek