Hello everyone.
I need to put a drop dropdown menu on items(such as a category)that is pulled from a database. I have used php+ mysql to pull the data. Can anyone tell me if I can include javascript so that when the mouse is over tha item and/or category, a drop down list appears. Example I have a Books category,when someone places the mouse over it, a dropdown menu appears eg for cildren books, cook books....
Any help would be greatly appreciated.
Regards
Omesa

Recommended Answers

All 5 Replies

I'm kind of new to PHP, but you should be able to use PHP to throw out the javascript.

<? 
echo "<script language=\"javascript\">"
echo "javascript code here"
echo "</script>"

I have not tried this, but it should work. Make sure to use the "\" before any quotes or PHP will think thats for him. Can someone correct me if I'm wrong?

Keep in mind that some computers will not have javascript enabled.

Oops, forgot the trailing:

%>

Oops, forgot the trailing:

%>

OOPS AGAIN!!!

I use ASP at work. Should be trailing:

?>

:eek:

While you can build a Javascript powered dropdown there is very little need to. All of the same functionality can be built using standard markup and modern CSS. Google for 'Son of Suckerfish' for examples of scriptless, multilevel dropdown/flyout menus.

Or just view DaniWeb's source code ;) The navigation menu we use here is pure CSS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.