jean_br 0 Denunciar post Postado Agosto 26, 2006 Fala pessoal... não entendo muito de javascript assim.. peguei esse script na net var combo1=new Array()combo1[0]=new Option("JavaScript Kit","http://javascriptkit.com")combo1[1]=new Option("Dynamic Drive","http://www.dynamicdrive.com")combo1[2]=new Option("Freewarejava.com","http://www.freewarejava.com")combo1[3]=new Option("Free Web Templates","http://www.freewebtemplates.com")combo1[4]=new Option("Web Monkey","http://www.webmonkey.com")var combo2=new Array()combo2[0]=new Option("CNN","http://www.cnn.com")combo2[1]=new Option("MSNBC","http://www.msnbc.com")combo2[2]=new Option("BBC News","http://news.bbc.co.uk")combo2[3]=new Option("ABC News","http://www.abcnews.com")var cacheobj=document.itemForm.stage2function populate(x){for (m=cacheobj.options.length-1;m>0;m--)cacheobj.options[m]=nullselectedarray=eval(x)for (i=0;i<selectedarray.length;i++)cacheobj.options[i]=new Option(selectedarray[i].text,selectedarray[i].value)cacheobj.options[0].selected=true}function gothere(){location=cacheobj.options[cacheobj.selectedIndex].value}//SHOW first combo by defaultpopulate(combo1)//--> que é acionado por esses links: <a href="java script:populate(combo1)">Webmaster sites</a> | <a href="java script:populate(combo2)">News sites</a> como posso fazer para transformar esses links em um combo... eu quero 2 combos onde o 1º chamaria o segundo.... se puderem me ajudar..... Compartilhar este post Link para o post Compartilhar em outros sites
jean_br 0 Denunciar post Postado Agosto 26, 2006 ok pessoal..... acabei encontrando um script (double combo) que faz o que eu queria..... abaixo está o código... um abraço <form name="doublecombo"><p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)"><option>Technology Sites</option><option>News Sites</option><option>Search Engines</option></select><select name="stage2" size="1"><option value="http://javascriptkit.com">JavaScript Kit</option><option value="http://www.news.com">News.com</option><option value="http://www.wired.com">Wired News</option></select><input type="button" name="test" value="Go!"onClick="go()"></p><script>var groups=document.doublecombo.example.options.lengthvar group=new Array(groups)for (i=0; i<groups; i++)group[i]=new Array()group[0][0]=new Option("JavaScript Kit","http://javascriptkit.com")group[0][1]=new Option("News.com","http://www.news.com")group[0][2]=new Option("Wired News","http://www.wired.com")group[1][0]=new Option("CNN","http://www.cnn.com")group[1][1]=new Option("ABC News","http://www.abcnews.com")group[2][0]=new Option("Hotbot","http://www.hotbot.com")group[2][1]=new Option("Infoseek","http://www.infoseek.com")group[2][2]=new Option("Excite","http://www.excite.com")group[2][3]=new Option("Lycos","http://www.lycos.com")var temp=document.doublecombo.stage2function redirect(x){for (m=temp.options.length-1;m>0;m--)temp.options[m]=nullfor (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}//--></script></form> Compartilhar este post Link para o post Compartilhar em outros sites