Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I insert a java drop down menu

Posted on 2010-09-10
11
Medium Priority
?
620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

 

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
 

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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logiā€¦
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

730 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