Hello all
I'm trying to do a triple combo box with descriptions and found this code below on internet:
I'm trying to learn javascript.. but I don't know much. I couldn't change this javascript to 3 combo boxes. I'm trying to make boxes with Maker, Car Model and Year. If possible, when the user hit GO, to the show the description into a div, and do not go to a website.
Thanks!Code:<form name="doublecombo"> <select name="example" size="1" onChange="redirect(this.options.selectedIndex); displaydesc()"> <option>SimplytheBest Shareware</option> <option>SimplytheBest Affiliates</option> <option>SimplytheBest Metasearch</option> </select> <select name="stage2" size="1" onchange="displaydesc()"> <option value="http://simplythebest.net/shareware.html">Index</option> <option value="http://simplythebest.net/business.html">Business</option> <option value="http://simplythebest.net/graphics.html">Graphics</option> </select> <input type="button" name="test" value="Go!" onClick="go()"> <br /> <input type="text" name="txtdisplay"> </form> <script> <!--// Orignal Scripts: ////// Double Combo Script By Website Abstraction (www.wsabstract.com) ////// Drop down menu w/ description by Dynamic Drive (www.dynamicdrive.com) var groups=document.doublecombo.example.options.length var group=new Array(groups) var descr=new Array(groups) for (i=0; i<groups; i++){ group[i]=new Array() descr[i]=new Array() } group[0][0]= new Option("Index","http://simplythebest.net/shareware.html") descr[0][0]= "Index description"; group[0][1]= new Option("Business","http://simplythebest.net/business.html") descr[0][1]= "Business description"; group[0][2]= new Option("Graphics","http://simplythebest.net/graphics.html") descr[0][2]= "Graphics description"; group[1][0]=new Option("Art and Photo","http://www.simplythebest.net/affiliates/affiliate_programs/art_photo.html") descr[1][0]= "Art and Photo description"; group[1][1]=new Option("Books","http://www.simplythebest.net/affiliates/affiliate_programs/books.html") descr[1][1]= "Books description"; group[1][2]=new Option("Clothing","http://www.simplythebest.net/affiliates/affiliate_programs/clothing.html") descr[1][2]= "Clothing description"; group[2][0]=new Option("Web Search","http://www.simplythebest.net/search/search.html") descr[2][0]= "Web Search description"; group[2][1]=new Option("Auctions Search","http://www.simplythebest.net/search/auctions.html") descr[2][1]= "Auctions Search description"; group[2][2]=new Option("MP3 Search","http://www.simplythebest.net/search/mp3search.html") descr[2][2]= "MP3 Search description"; group[2][3]=new Option("Job Search","http://www.simplythebest.net/search/jobs.html") descr[2][3]= "Job Search description"; var temp=document.doublecombo.stage2 function redirect(x){ for (m=temp.options.length-1;m>0;m--) temp.options[m]=null for (i=0;i<group[x].length;i++){ temp.options[i]=new Option(group[x][i].text,group[x][i].value) } temp.options[0].selected=true } function go(){ location=temp.options[temp.selectedIndex].value } function displaydesc(){ var desc=descr[document.doublecombo.example.selectedIndex][document.doublecombo.stage2.selectedIndex]; document.doublecombo.txtdisplay.value=desc; } displaydesc() //--> </script>



Reply With Quote
Bookmarks