I have a problems about a dynamic menu
Posted: Mon Oct 25, 2004 7:14 am
Sami | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have like a menu, which it has a two menu: category and subcategory.
When I click a menu -category, open a subcategory about of this category:
example:
3 categories: cars, boats, truck...
subcategory: cars -> BMW, Renault, Ford, Seat...
boats ->Pershing, Marines....
truck ->Volvo, Marcedes, Scania ....
These I have like in a php form, when I add this....category, subcategory ...etc
I have an example , but it have errors...help me... or other exampleCode: Select all
<script Language="JavaScript">
Povezave=new Array(1);
Povezave[0]=new Array(0);
Povezave[1]=new Array(3);
Povezave[2]=new Array(4);
Povezave[0][0]="";
//Gospodinjski aparati;
Povezave[1][0]="";
Povezave[1][1]="Seat";
Povezave[1][2]="BMW";
Povezave[1][3]="Renault";
//Bela tehnika;
Povezave[2][0]="";
Povezave[2][1]="Pershing";
Povezave[2][2]="Marines";
Povezave[2][3]="xxxx";
Povezave[2][4]="yyyyy";
function BuildPovezave(num)
{
document.admin.model.selectedIndex=0;
for(ctr=0;ctr<Povezave[num].length;ctr++)
{
document.admin.model.options[ctr]=new Option(Povezave[num][ctr],Povezave[num][ctr]);
}
document.admin.model.length=Povezave[num].length;
}
function BuildPovezave2(num)
{
document.admin.model.selectedIndex=0;
for(ctr=0;ctr<Povezave[num].length;ctr++)
{
document.admin.model2.options[ctr]=new Option(Povezave[num][ctr],Povezave[num][ctr]);
}
document.admin.model2.length=Povezave[num].length;
}
</script>
<?php
form....
print "<tr><td width="25%"><div align="right"><font size="1">kategorija:</font></div></td></tr>";
print "<tr><td width="75%"><select name="znamka" size="1" class="form_field" id="znamka" style="width: 170px" onChange="BuildPovezave(this.selectedIndex);">";
print "<option selected value="0">vsi tipi</option>";
print "<option Value=Cars>Cars</option>";
print "<option Value=Boats>Boats</option>";
print "</SELECT> ";
print "</td></tr>";
print "<tr><td width="25%"><div align="right"><font size="1">podkategorija:</font></div></td></tr>";
print "<tr><td width="75%"><select name="model" size="1" class="form_field" id="select" style="width: 170px">";
print "<option value="0">vsi modeli</option>";
print "</SELECT> ";
print "</td></tr>";
?>