Solved

How do I insert a java drop down menu

Posted on 2010-09-10
11
607 Views
Last Modified: 2013-11-23
I am trying to insert a java drop down menu into a web page.  I can do so with a regular menu by using

<!--#include virtual="menu.asp" -->

The problem is when I do this with with my java menu, as soon as you leave the main menu to try to navigate the sub menu it goes away.  Is there a way I can insert the menu so I can edit the menu in one single location when making changes to the menu both cosmetic and operational.
0
Comment
Question by:Pangeia
  • 6
  • 5
11 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33649541
Java or javaSCRIPT?

Normally with JS you just do
<script src="menu.js" type="text/javascript"></script>
0
 

Author Comment

by:Pangeia
ID: 33649919
Yes.  In the header.

Im talking about doing something like this.

defalut.asp

<html>

<head>
<script src="Menu/dbMenu.js" type="text/javascript"></script>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>

<body>
<div align="left">
      <table border="0" width="600">
            <tr>
                  <td bgcolor="#B0F0F0">&nbsp;</td>
                  <td bgcolor="#000000">&nbsp;</td>
                  <td bgcolor="#B30000">&nbsp;</td>
            </tr>
      </table>
</div>
<!--#include virtual="menu.asp" -->
<div align="left">
      <table border="0" width="600">
            <tr>
                  <td bgcolor="#FFB409">&nbsp;</td>
                  <td bgcolor="#3F3362">&nbsp;</td>
                  <td bgcolor="#3FA490">&nbsp;</td>
            </tr>
      </table>
</div>

</body>

</html>

menu.asp

<html>
<head>
      <title>Dropdown menu Menu Test</title>
      <script src="Menu/dbMenu.js" type="text/javascript"></script>
      <link href="Menu/global.css" type="text/css" rel="stylesheet" media="screen">
      <link href="Menu/dropDown.css" type="text/css" rel="stylesheet" media="screen">
</head>
<body>

<ul id="menu" class="dbMenu onMouse">
      <li style="left: 0px; top: 0px; width: 4em">Home</li>
                  <li style=width:15em><a class="download" title="Initiates file download" target="_blank" href="displaycontent.pdf">
                  Drop down menu item</a></li>
</ul>

</body>
</html>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33652209
That would not be a good idea.
the menu needs to not be an html document

So either

<ul id="menu" class="dbMenu onMouse">
      <li style="left: 0px; top: 0px; width: 4em">Home</li>
                   <li style=width:15em><a class="download"  title="Initiates file download" target="_blank"  href="displaycontent.pdf">
                  Drop down menu item</a></li>
</ul>

or the most

<script src="Menu/dbMenu.js" type="text/javascript"></script>
      <link href="Menu/global.css" type="text/css" rel="stylesheet" media="screen">
      <link href="Menu/dropDown.css" type="text/css" rel="stylesheet" media="screen">
<ul id="menu" class="dbMenu onMouse">
      <li style="left: 0px; top: 0px; width: 4em">Home</li>
                   <li style=width:15em><a class="download"  title="Initiates file download" target="_blank"  href="displaycontent.pdf">
                  Drop down menu item</a></li>
</ul>

but I would not include dbMenu in the parent then.
0
 

Author Comment

by:Pangeia
ID: 33662122
I have been instructed I have to make the menu centralized.  SO there is one place where I make all changes and they reflect on all pages.

With css I can do this with things like colors and sizes, but I need it to be so that if I rename a button, or change a link, I only have to do it once.

This is what I'm looking for.  From the way your solution looks it still has me having to go to every page and changing the link on each individual page.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33662404
No, you only ever edit menu.asp
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Pangeia
ID: 33662804
OK.  I tried to do what I thought you said.  I feel I need to explain... I have limited experience in web design and do not know java, but have been tasked with getting this done.  STRESS

When I replaced the code on the menu page with...

<script src="Menu/dbMenu.js" type="text/javascript"></script>
     <link href="Menu/global.css" type="text/css" rel="stylesheet" media="screen">
     <link href="Menu/dropDown.css" type="text/css" rel="stylesheet" media="screen">
<ul id="menu" class="dbMenu onMouse">
     <li style="left: 0px; top: 0px; width: 4em">Home</li>
                  <li style=width:15em><a class="download"  title="Initiates file download" target="_blank"  href="displaycontent.pdf">
                 Drop down menu item</a></li>
</ul>

it no longer loads into the web page.  Was I wrong in my interpretation that I was to make it a blank page and paste this in there?  Was I supposed to have left some of the original code there?
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 33662953
I cannot say it is the nicest menu I have ever seen, but it sure looks standalone enough to me:

<script src="http://www.javascriptkit.com/script/script2/dbmenu/dbMenu.js" type="text/javascript">

	/***********************************************
	* DbMenu script- by David Boggus: http://www.boggusweb.com/
	* Please keep this notice intact
	* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
	***********************************************/

	</script>
	<link href="http://www.javascriptkit.com/script/script2/dbmenu/global.css" type="text/css" rel="stylesheet" media="screen">
	<link href="http://www.javascriptkit.com/script/script2/dbmenu/dropDown.css" type="text/css" rel="stylesheet" media="screen">
	<ul id="menu" class="dbMenu onMouse">

        <li><a href="http://www.javascriptkit.com">Home</a></li>
		<li>News
            <ul>
				<li><a href="http://www.cnn.com">CNN</a></li>
        <li><a href="http://news.bbc.co.uk">BBC News</a></li>
        <li><a href="http://abcnews.com">ABC News</a></li>
            </ul>

		</li>

	    <li>Web Design
            <ul>
                <li><a href="http://javascriptkit.com">JavaScipt Kit</a></li>
                <li><a href="http://dynamicdrive.com">Dynamic Drive</a></li>
                <li><a href="http://www.cssdrive.com">CSS Drive</a></li>
                <li><a href="http://www.codingforums.com">Coding Forums</a></li>

            </ul>
	    </li>
	    <li><a href="http://javascriptkit.com/jsref/">JS Reference</a></li>
	    <li><a href="http://javascriptkit.com/domref/">DOM Reference</a></li>

	</ul>

Open in new window

0
 

Author Comment

by:Pangeia
ID: 33663806
Thanks so much.

IT works great.

My menu inserts and when I move my mouse down to the sub menu, the menu stays and I can click my links.
0
 

Author Closing Comment

by:Pangeia
ID: 33663820
It helped me complete my task.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33663834
Make sure to change the paths to your own paths. Perhaps that was your problem...
0
 

Author Comment

by:Pangeia
ID: 33663986
Actually, I did try tinkering with my original website I was working with.

The problem was very simple.

As you had stated I should not have had reference to the java script in the parent page.  Once I removed it, it started working.

Just thought I would throw that out there.  Thanks again.  Learned a lot.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now