mhoggatt1
asked on
Javascript Dropdown Menu
I'm looking for the Javascript code that loads car makes into a dropdown menu and changes the page to Makes when a selection is made. I have one but I'm not sure it's what I'm looking for. I'll be loading it from a DB.
Thanks,
Michael
Thanks,
Michael
I assume you have abandon the other post on javasript menus?
I would use a javascript tools as mentioned www.likno.com they also provide an interface for dynamic menus from databases.
but I think you mean you want the menu to read fom the database? - actually what you want is a standard javasript menu to link to all the pages (likno or the free site I mentioned) and its the pagesget loaded that then access the database to produce the page.
I would use a javascript tools as mentioned www.likno.com they also provide an interface for dynamic menus from databases.
but I think you mean you want the menu to read fom the database? - actually what you want is a standard javasript menu to link to all the pages (likno or the free site I mentioned) and its the pagesget loaded that then access the database to produce the page.
by menu you mean a selection list?
Do you want an AJAX solution?
Do you want an AJAX solution?
ASKER
Actually I have a routine Which I would like modified. It's a Javascript routine written for me a couple of years ago. It has a dropdown menu in the left frame that changes the right frame.
I don't know anything about JS. So I need this one modified or you could write a new one for me that does this -
When the selection is made it displays the page (no frames). In this case the variable action_name will be in the menu and it will link to directory_link which is a php page.
Here's my code -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<Script language="JavaScript"><!--
function jumpMenu(targ,selObj,resto re){
eval(targ+".location='"+se lObj.optio ns[selObj. selectedIn dex].value +"'");
if (restore) selObj.selectedIndex=0;
}
//--></Script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>bsd_select.php</tit le>
</head>
<body>
<form>
Search the Database <br>
<select style="width:125px" name="menu1" onChange="jumpMenu('parent .mainFrame ',this,0)" ><option>M ake a Selection</option>
<?php
$include_path = "";
require_once($include_path . 'uis.php');
require_once($include_path . 'myconfig.php');
$i=0;
$j=0;
// $result = mysql_query("SELECT DISTINCT ministryID, ministry_name, ministry_link FROM ".$myconfig->dt['ministrie s']." ORDER BY ministry_name ASC") or die("Sql error : " . mysql_error());
$result = mysql_query("SELECT DISTINCT jz_directoryID, action_name, directory_link FROM ".$myconfig->dt['jz_direct ory']." ORDER BY action_name ASC") or die("Sql error : " . mysql_error());
while ($row = mysql_fetch_array($result) ) {
echo "<option value=\"{$row['directory_l ink']}?id= {$row['jz_ directoryI D']}\">".$ row["actio n_name"]." </option>\ n";
}
?>
</select>
</form>
<?php
?>
</body>
</html>
I don't know anything about JS. So I need this one modified or you could write a new one for me that does this -
When the selection is made it displays the page (no frames). In this case the variable action_name will be in the menu and it will link to directory_link which is a php page.
Here's my code -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<Script language="JavaScript"><!--
function jumpMenu(targ,selObj,resto
eval(targ+".location='"+se
if (restore) selObj.selectedIndex=0;
}
//--></Script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>bsd_select.php</tit
</head>
<body>
<form>
Search the Database <br>
<select style="width:125px" name="menu1" onChange="jumpMenu('parent
<?php
$include_path = "";
require_once($include_path
require_once($include_path
$i=0;
$j=0;
// $result = mysql_query("SELECT DISTINCT ministryID, ministry_name, ministry_link FROM ".$myconfig->dt['ministrie
$result = mysql_query("SELECT DISTINCT jz_directoryID, action_name, directory_link FROM ".$myconfig->dt['jz_direct
while ($row = mysql_fetch_array($result)
echo "<option value=\"{$row['directory_l
}
?>
</select>
</form>
<?php
?>
</body>
</html>
Try changing:
eval(targ+".location='"+se lObj.optio ns[selObj. selectedIn dex].value +"'");
to
eval(top.location='"+selOb j.options[ selObj.sel ectedIndex ].value+"' ");
eval(targ+".location='"+se
to
eval(top.location='"+selOb
Better yet, change
onChange="jumpMenu('parent .mainFrame ',this,0)"
to
onChange="jumpMenu('top',t his,0)"
onChange="jumpMenu('parent
to
onChange="jumpMenu('top',t
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works great ! Thanks you very much for the rewrite. I increased the points to 500 for the expert service. Hope to do business with you again.
Michael
Michael
ASKER
I posted the same thing at this address -
https://www.experts-exchange.com/questions/22905510/Java-code-modify.html
Which han't been replied to. Just post your rewrite to this one and I'll give you another 500 poins !
https://www.experts-exchange.com/questions/22905510/Java-code-modify.html
Which han't been replied to. Just post your rewrite to this one and I'll give you another 500 poins !
Thank you very much. You are now in my "preferred customer" list
ASKER