Dynamic Drop Down List ( Jumping Menu )
Hey everyone,
i am trying to create a list menu, for a automobile website in which you search a model by first selecting a year from the drop down list and then in the next drop down list you select the make/model and then press go to go to the particular page of that model/make .
I have made them in a form but cant get to work....
------------------------below is to give you and idea -----------------
<head>
<script type="text/javascript">
<!--
function MM_jumpMenuGo(objId,targ,restore){ //v9.0
var selObj = null; with (document) {
if (getElementById) selObj = getElementById(objId);
if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0; }
}
//-->
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label for="select">Model</label>
<select name="select" id="select" accesskey="M" tabindex="1">
<option value="volvo">Volvo</option>
<option value="alfa" selected="selected">Alfa Romeo</option>
<option value="nissan">Nissan</option>
<option value="benz">Mercedes</option>
</select>
<select name="jumpMenu2" id="jumpMenu2">
<option value="2009">2009</option>
<option value="2008">2008</option>
</select>
<input type="button" name="go_button2" id= "go_button2" value="Go" onclick="MM_jumpMenuGo('jumpMenu2','parent',0)" />
</form>
</body>
-----------------------------------------------------------------------
please help me out guys i'm confused
Thanks
chrike528 posted this at 21:13 — 4th February 2010.
They have: 1 posts
Joined: Feb 2010
1 problem I see is that the value of the option tag needs to be the link you want to load:
<select name="jumpMenu2" id="jumpMenu2">
<option value="2009">2009</option>
<option value="2008">2008</option>
</select>
Changed to:
<select name="jumpMenu2" id="jumpMenu2">
<option value="link_to_page1.html">2009</option>
<option value="link_to_page2.html">2008</option>
</select>
Mike Bruneau
http://www.compu-guy.com
Sokol posted this at 17:44 — 16th February 2010.
They have: 1 posts
Joined: Feb 2010
In such case, according to php tutorials i use php code
function maketree($rootcatid,$level)
{
$sql="select catid,cat_name
from tbl_name
where parentid=$rootcatid
order by cat_name";
$result=mysql_query($sql);
while (list($DBcatid,$DBcatname)=mysql_fetch_row($result))
{
$width=($level+1)*24;
if ($width==48)
$display=" ";
if ($width==72)
$display=" ";
if ($DBcatid==1)
{
$display.="<option value=$DBcatid>";
}
else
{
$display.="<option value=$DBcatid>";
}
$display.="$DBcatname</option>";
echo $display;
maketree($DBcatid,$level+1);
}
}
?>
<table cellpadding="2" cellspacing="2" border="0" width="width="100%"">
<tr>
<td><select name="">
<? maketree(0,0);?>
</select></td>
</tr>
</table>
JeevesBond posted this at 05:14 — 17th February 2010.
He has: 3,956 posts
Joined: Jun 2002
Oh wow, this is an old post. Sorry no-one answered it at the time.
Is this still an issue? If so, could you post a URL?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.