Adobe Dreamweaver
--
Questions
--
Followers
Top Experts
I need three drop down boxes...
the first will have a list of auto manufacturers (like Honda, Toyota, Mazda)
the second field will dynamically be populated depending on what I select on the first field.
So if I select Toyota on the first field the second will say (Camry, Corolla, 4 runner, Land Cruiser)
And the 3rd field will be populated depending on what I select on the second field.
If I say 4 Runner I should get (4WD, 2WD,) etc... etc... etc...
can I do this without having to pull the data from a database, (I don't care if I have to type everything out)
And if I have to pull it from a database, how do I do it in dreamweaver MX.
I'm trying to do this using ASP.....
Thanks in Advance guys,
Jovix
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
u don't have to use database. u can store these info into XML file then parse it at runtime and grap ur data.
now u can open the XMl file and form ur dropdown menues.
i can help if u w r going to use flash
this could be done using javascript and asp too.
kanary.
<script LANGUAGE="javascript">
<!--
//************************
//purpose:submits the form to a specified URL
//example: onFocus="submitFormAction(
//returns: no return value
//************************
function submitFormAction(vsPage){
      document.frmAttorney.actio
  document.forms[0].submit()
}
//-->
</script>
Then put this form on your page
<form name="frmMain" action="index.asp method="post">
<select name="make" onChange="submitFormAction
<option value="0">Select Make</option>
<option value="1">Honda</option>
<option value="2">Toyota</option>
<option value="3">Mazda</option>
...
</select>
<select name="model" >
<option value="0">Select Model</option>
<%
if request("make")=1 then
%>
      <option value="1">Accord</option>
      <option value="2">Civic</option>
      ...
<%
elseif request("make") = 2 then
%>
      <option value="1">Camry</option>
      <option value="2">Corolla</option>
      <option value="3">4 runner</option>
      <option value="4">Land Cruiser</option>
      ...
<%
end if
%>
...
</select>
</form>






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
http://www.aspfree.com/articles/1358,1/articles.aspx
https://www.experts-exchange.com/questions/20555637/This-is-all-about-multiple-dropdown-boxes-and-onchange-procedure.html
if you want it to be database driven then you can refer to the link below...
https://www.experts-exchange.com/questions/20496541/Dynamical-3-way-drop-down-menu.html
HTH...
HAppy programming...
Do you have Fireworks?
They have an easy Gui Interface that gives you pop up menus with as many submeus off the pop up menus as well. Â You can do this with Firworks 5 or MX.
I tried using you're code, but I'm not able to use numbers as part of the selections in the menu...for example.
I tried using a numbers here, I replaced "yama","Honda",etc... with "1999",2000",2001", but when I run the page it doesn't work, I get a runtime error. why?
var 1999 =new Array("1999","2000","2001"
var 2000 = new Array("1800","1900")
var 2001 = new Array("Mehran","Jeta","Isu
can you help please..
thanks, Jovix

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
http://www.aspfree.com/articles/1358,1/articles.aspx
Below is the code from the link above...
save this as optionex.html
======
<!-- saved from url=(0022)http://internet.e-mail -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>OptionEx Include</TITLE>
<!--include the library-->
<script language=Javascript src="optionex.js"></script
<script language=Javascript>
//create ourlink list of different model Series
var oModelSeries = new OptionCollection();
//add a few entries this can also be written via asp dynamically
//3 series
oModelSeries.Add("318","31
oModelSeries.Add("318s","3
oModelSeries.Add("320","32
oModelSeries.Add("325","32
oModelSeries.Add("328","32
oModelSeries.Add("M3","M3 Series","3S");
//5 series
oModelSeries.Add("520","52
oModelSeries.Add("525","52
oModelSeries.Add("535","53
oModelSeries.Add("540","54
oModelSeries.Add("M5","M5"
//7 series
oModelSeries.Add("735","73
oModelSeries.Add("740","74
oModelSeries.Add("750","75
//okay so we have all the series for the models.
//lets add the colors of the series.
//again this can be written dynamically
var oSeriesColors = new OptionCollection();
oSeriesColors.Add("318red"
oSeriesColors.Add("318navy
oSeriesColors.Add("318silv
oSeriesColors.Add("318swhi
oSeriesColors.Add("318snav
oSeriesColors.Add("320silv
oSeriesColors.Add("325whit
oSeriesColors.Add("325red"
oSeriesColors.Add("328navy
oSeriesColors.Add("328blac
oSeriesColors.Add("m3yello
oSeriesColors.Add("m3gray"
//5 series
oSeriesColors.Add("520red"
oSeriesColors.Add("520navy
oSeriesColors.Add("520silv
oSeriesColors.Add("525whit
oSeriesColors.Add("525navy
oSeriesColors.Add("535silv
oSeriesColors.Add("535whit
oSeriesColors.Add("535red"
oSeriesColors.Add("540navy
oSeriesColors.Add("m5yello
oSeriesColors.Add("m5gray"
//7 series
oSeriesColors.Add("735red"
oSeriesColors.Add("735navy
oSeriesColors.Add("740silv
oSeriesColors.Add("740whit
oSeriesColors.Add("740navy
oSeriesColors.Add("750silv
</script>
</HEAD>
<BODY>
<p align=center><h1>ASP Tips and Tricks</h1></p><br>
By: Salim Naim
<table><form name=carform id=carform>
      <tr><td><h3>Introduction</
      <tr><td>
           <table><tr><td><font face=arial size=2>
          Â
<p class=MsoNormal>As the web is transforming to providing much more data
driven dynamic content, it痴 only logical to provide user of your web site/web
applications, the application usability they are use to on their desktop
applications.</p>
<p class=MsoNormal>One of the most annoying things that I find when going to
web site whether it痴 a support site or online automotive web sites is the that
most list box selection are done in a simple and unusable manner. For example
multiple list box that contain a relationship together assume that the user
understands the relation and will obey the way the site or application wants
his/her interaction to be.</p>
<p class=MsoNormal>An example of what I知 going on about is an online used car
web site. Now the list box (<SELECT>) will have a selection of car type,
also another list box will be the series provided in this current model type
and finally the colors available for this model and series.</p>
<p class=MsoNormal>Now this article is about a generic JavaScript include file
that can be used to implement SELECT option relationships.</p>
          Â
           </td></tr></table>
      </td></tr>
      <tr><td>
           <table>
                 <tr>
                      <td colspan=6><font face=arial size=2><b>Example :&n
                 </tr>
                 </tr>
                 <tr>
                      <!--parent select-->
                      <td align=right valign=top><font face=arial size=2><b>Model :&nbs
                      <td align=left valign=top><SELECT name=model id=model onchange="UpdateSelect('se
                            <option value="">[Select a Model]</option>
                            <option value="7S">BMW 7 Series</option>
                            <option value="5S">BMW 5 Series</option>
                            <option value="3S">BMW 3 Series</option>
                      </select></td>
                      <td align=right bgcolor=lightgrey><font face=arial size=2><b>Series :&nb
                      <a href="javascript:clearOpti
                      </td>
                      <!--blank dummy option, need for navigator to set the size of dropdown list-->
                      <!-- three options a list is fine-->
                      <!--IE dynamically resizes the width of the select navigator doesn't-->
                      <!--so just give the option blank space or caption to set the size-->
                      <td align=left valign=top><SELECT name=series id=series onchange="UpdateSelect('ca
                            <option>[Select a Series]</option>
                            <option></option>
                            <option></option>
                            <option></option>
                      </select></td>
                      <td align=right bgcolor=lightgrey><font face=arial size=2><b>Color(s) :&
                      <a href="javascript:clearOpti
                      </td>                      Â
                      <td align=left valign=top><SELECT name=carcolors id=carcolors >                           Â
                            <option>[Select a color(s)]</option>
                            <option></option>
                            <option></option>
                            <option></option>                                                       Â
                      </select></td>
                 </tr>     Â
           </table>
      </td></tr>
</form></table>
<table>
      <tr><td><h3>Help?</h3></td
      <tr><td>
           <table><tr><td><font face=arial size=2>
                Â
Using the example, just select the car model you are
interested in and the series selection will be dynamically updated for you, the
clear all is an option to clear all the list box entries. Once a series is
selected, a color will be updated for that series in the color list box.
           </font></td></tr></table>
      </td></tr>
</table>
<table>
      <tr><td bgcolor=DarkGray><h3>Expla
      <tr><td>
           <table><tr><td><font face=arial size=2>
                Â
<p class=MsoNormal>To use optionex.js, all you have to do is just follow the
following steps.</p>
<p class=MsoNormal><![if !supportEmptyParas]>
<p class=MsoNormal>1 -<span style='mso-tab-count:1'>&#
language=JavaScript src="optionex.js"
<p class=MsoNormal>once you have added the library, all the code need to
implement a relationship between the list box is included.</p>
<p class=MsoNormal><i>Note</i
things can be learnt,</p>
<p class=MsoNormal><span style='mso-tab-count:1'>&#
style='mso-tab-count:1'>&#
a link list in JavaScript.</p>
<p class=MsoNormal><span style='mso-tab-count:1'>&#
style='mso-tab-count:1'>&#
programming the select element in IE and navigator.</p>
<p class=MsoNormal><![if !supportEmptyParas]>
<p class=MsoNormal>2 - <span style='mso-tab-count:1'>&#
have included the library the next thing to do is to create our custom
OptionCollection class </p>
<p class=MsoNormal><b><span style='mso-tab-count:1'>&#
oModelSeries = new OptionCollection();<o:p></
<p class=MsoNormal>This is the collection of entries for the Model to series
relationship.</p>
<p class=MsoNormal><b><span style='mso-tab-count:1'>&#
oSeriesColors = new OptionCollection();<o:p></
<p class=MsoNormal>This is the collection of entries for the Series to color
relationship.</p>
<p class=MsoNormal><![if !supportEmptyParas]>
<p class=MsoNormal>3 -<span style='mso-tab-count:1'>&#
thing to do is enter the information that links the paren listbox with the
child list box. This is done via the function</p>
<p class=MsoNormal style='margin-left:.5in;te
;<o:p></o:p></b></p>
<p class=MsoNormal style='margin-left:.5in;te
<p class=MsoNormal>Now lets have a close look at the parameters that ADD needs,</p>
<p class=MsoNormal style='margin-left:.75in;t
tab-stops:list .75in'><![if !supportLists]>1<span style='font:7.0pt "Times New Roman"'>
</span><![endif]>- <b>child</b> this is the unique id for the child element.
This argument is basically what痴 going to be placed in the <option
value=把hild・
<p class=MsoNormal style='margin-left:.75in;t
tab-stops:list .75in'><![if !supportLists]>2<span style='font:7.0pt "Times New Roman"'>
</span><![endif]>・<
child value.</p>
<p class=MsoNormal style='margin-left:.75in;t
tab-stops:list .75in'><![if !supportLists]>3<span style='font:7.0pt "Times New Roman"'>
</span><![endif]>・<
triggering list box that is associated with this element.</p>
<p class=MsoNormal style='margin-left:.5in'><
<p class=MsoNormal><i>Note </i>: that the assumption of unique is made, yes the
library expects that the<span style="mso-spacerun: yes"> </span>values that
form the relationship are unique. This might at first seem silly and that I知
stating the obvious but I値l go over this again. The model number in our
example eg.3S must be unique in the model list box and the child elements for
this model must all have unique values as well as a relationship link to there
parent relation.</p>
<p class=MsoNormal><![if !supportEmptyParas]>
<p class=MsoNormal>4 -<span style='mso-tab-count:1'>&#
step you have to follow to have the sample implemented is trigger the update in
the calling list box.</p>
<p class=MsoNormal><![if !supportEmptyParas]>
<p class=MsoBodyText>Eg:
onchange="UpdateSelec
<p class=MsoNormal><![if !supportEmptyParas]>
<p class=MsoNormal>now the function UpdateSelect is were all the magic of this
library begins, the first parameter is the name of the child list box to
update, the second parameter is the name of the form <FORM> that the two
related list box are in. the fourth parameter is the currently selected list
box option (this remains the same), the last parameter is the collections to
use to peform the update from.</p>
<p class=MsoNormal>And that・basically it, we have a collections of our values
and a generic function that updates the related select elements using the
collection provided.</p>
<p class=MsoNormal><![if !supportEmptyParas]>
           </font></td></tr></table>
      </td></tr>
</table>
<table>
      <tr><td><h3>Hacks to add</h3></td></tr>
      <tr><td>
           <table><tr><td><font face=arial size=2>
<p class=MsoNormal>Now the sample is fine but it needs a few hacks to make sure
that it functions under navigator. Now navigator doesn稚 handle dynamic select
element expansion too well so you have to enter dummy <OPTION> tags to
foul it to render the dropdown section correctly. So we have to add dummy
<OPTION></OPTION&
element.</p>
<p class=MsoNormal>The other hack is the width, the width of a select element
has to dynamically change when the content changes, navigator also doesn稚 support
this feature. So to pull a blind one on it, all you have to do is place a
standard <OPTION>[Select ・]</OPTION> tag that will set a width for
our list box.</p>
<p class=MsoNormal>Other than these two hacks, the library will work on any 4.X
browsers.</p>
<p class=MsoNormal>For extra information you can reach me at</p>
<p class=MsoNormal><a href="http://salimnaim.webjump.com/">http://salimnaim.webjump.com</a></p>
           </font></td></tr></table>
      </td></tr>
</table>
</BODY>
</HTML>
========== then save this as optionex.js
var NS4 = (document.layers)?true:fal
var IE4 = (document.all)?true:false;
     Â
function _struct(child,childcaption
this.child = child;
this.childcaption = childcaption;
this.parent      = parent;
}
function _addobject(child,childcapt
var obj = new _struct();
obj.child = child;
obj.childcaption = childcaption;
obj.parent = parent;
return(obj);
}
function insertEntry(child,childcap
      if(child.length > 0 ){           Â
           for(var i=0;i<this.length;i++)
                 if(this.items[i].child == child)
                      return;                Â
           this.items[this.length++] = _addobject(child,childcapt
      }
}
function OptionCollection(){
this.length=0;
this.items = new Object();
this.Add=insertEntry
}
function clearSelect(oSelect){
var iCount=0;
if(!oSelect) return;
iCount = oSelect.options.length;
for(var i=0;i<iCount;i++){
      if(IE4)
           oSelect.options.remove(0);
      else if(NS4)
           oSelect.options[0]=null;
}
}
function addOptions(oSelect,olist,p
      var elOption;
      var idxSelect=0;     Â
      //check arguments.
      if((!olist) || (!oSelect))return;           Â
      if(parent.length <=      0)       return;
                           Â
      //now looop through all the list items only entering relevant options.
      clearSelect(oSelect);     Â
     Â
      //add a blank list
      elBlankOption = new Option();
      elBlankOption.text = "";
      if(NS4) oSelect.options[0] = elBlankOption
      else if(IE4) oSelect.options.add(elBlan
     Â
      elBlankOption.value = "";
      for(var i=0;i<olist.length;i++){           Â
           //only the child entries of the parent                      Â
           if(olist.items[i].parent == parent){                                                 Â
                 elOption = new Option();
                 //now IE and NS have a different way to handle object creation.
                 if(NS4){                                 Â
                      elOption.value = olist.items[i].child
                      elOption.text = olist.items[i].childcaptio
                      oSelect.options[idxSelect]
                 }else if(IE4){                      Â
                      elOption.value = olist.items[i].child
                      elOption.text = olist.items[i].childcaptio
                      oSelect.options.add(elOpti
                 }                                 Â
                 idxSelect++;
                 delete(elOption);
           }                Â
      }     Â
}
function clearOptions(szSelect,szFo
if(szSelect.length <= 0 || szForm.length <=0)
      alert("error:clearOption must pass arguments");     Â
if(IE4)
clearSelect(document.all.i
else if(NS4)
clearSelect(eval('document
}
function listAllOptions(szSelect,sz
      var elOption;
      var idxSelect=0;
      var oSelect = new Object();
                Â
      //check arguments.
      if(!olist)return;                Â
     Â
      if(IE4)
            oSelect = document.all.item(szSelect
      else if(NS4)
           oSelect = eval('document.' + szForm + '.' + szSelect);
     Â
      if(!oSelect)return;                Â
                                Â
      //now looop through all the list items entering all
      clearSelect(oSelect);
      for(var i=0;i<olist.length;i++){                                      Â
           elOption = new Option();
           //now IE and NS have a different way to handle object creation.
           if(NS4){                                 Â
                 elOption.value = olist.items[i].child
                 elOption.text = olist.items[i].childcaptio
                 oSelect.options[idxSelect]
           }else if(IE4){                      Â
                 elOption.value = olist.items[i].child
                 elOption.text = olist.items[i].childcaptio
                 oSelect.options.add(elOpti
           }                                 Â
           idxSelect++;
           delete(elOption);                           Â
      }     Â
}
function UpdateSelect(szSelect,szFo
if(IE4)
addOptions(document.all.it
else if(NS4)
addOptions(eval('document.
}
HTH...
HAppy programming...
What you can do is name them like this
var a_1999 Â = new Array("111","222")
var a_2000 = new Array("2000","333")






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
But anyway, Take out onMouseOut Event from your Button in HTML.
Thanks...
Adobe Dreamweaver
--
Questions
--
Followers
Top Experts
Adobe Dreamweaver is a web development tool featuring both WYSIWYG and code editors that allow the user to quickly and easily build websites in a wide variety of languages, including ASP, ASP.NET, ColdFusion and PHP. It also offers support for CSS and JavaScript.