Link to home
Start Free TrialLog in
Avatar of maddy007
maddy007

asked on

Script for an onmouseover to bring up a submenu

I need a script to bring up a submenu of links.  I like how it alleviates the problem of clicking on a link only to get to another list of links.  My idea for the format of the page would be to have a table with 3 columns.  The left column would have the basic menu.  The right column would have a slideshow of pictures.  The middle column would have a faint background image and then when someone mouses over a basic menu item, another sub menu of clickable links would come into this cell of the table. Also, can the submenu actually be an image map?
Avatar of nzjonboy
nzjonboy

here's a tutorial, is this along the lines of what your after?

http://www.webreference.com/dhtml/column42/index.html

nzjonboy
Avatar of maddy007

ASKER

These tutorials are on the right track of what I want, but the sub menu that pops up does not seem to have the ability to dictate where it will pop up.  When the sub menu pops up, I want it to look like it belonged there all along... in the center of a table
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
     <title>Untitled</title>
     <script>
<!--

var content=new Array()
//change the array below to the links associated with menu links Expand or contract the array, depending on how many menus you have
content[0]='<b>menu1</b><br><a href="link1.html">link1</a><br><a href="link2.html">link2</a><br><a href="link3.html">link3</a>'
content[1]='<b>menu2</b><br><a href="link1.html">link1</a><br><a href="link2.html">link2</a><br><a href="link3.html">link3</a>'
content[2]='<b>menu3</b><br><a href="link1.html">link1</a><br><a href="link2.html">link2</a><br><a href="link3.html">link3</a>'

function recreate(){
window.location.reload()
}
function recreate2(){
if (document.layers){
appear()
setTimeout("window.onresize=recreate",450)
}
}

function changeMenu(whichMenu){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML=whichMenu
}
else if (document.layers){
document.first.document.second.document.write('<font face="Verdana">'+whichMenu+'</font>')
document.first.document.second.document.close()
}

}

function appear(){
document.first.visibility='show'
}

window.onload=recreate2


//-->
</script>
</head>

<body>
<table>
     <tr>
          <td>
<div id="scriptmenu" style="line-height:20px"><a href="#" onMouseover="changeMenu(content[0])">Menus
            and Navigation Systems</a><br>
            <a href="#" onMouseover="changeMenu(content[1])">Special&nbsp;document
            effects</a><br>
            <a href="#" onMouseover="changeMenu(content[2])">Scrollers</a><br>
     
</div>
          </td>
     
          <td>
          images
          </td>
         
          <td>


<ilayer id="first" width="200" height="200" visibility="hide">
<layer id="second" width="200" height="200">
<div id="descriptions" align="left">

<!--Change below to default menu-->
<b>menu1</b><br><a href="link1.html">link1</a><br><a href="link2.html">link2</a><br><a href="link3.html">link3</a>
<!--Stop editting-->

</div>
</layer>
</ilayer>
          </td>
     </tr>
</table>
</body>
</html>
and yes, the submenu could be an image map.  simply copy its html code into one of the variables in the array.
I must be stupid because the script you wrote for me doesn't seem to work.  Nothing happens on mouseover.  I'm sure I'm doing something wrong.  I copied and pasted it into a html editing program, saved it and then opened it with IE 5.5.  

Okay.  Once I get it to work... if I ever do, I'm glad to know you can use an image map because that would be very nice.
make sure that it's not working.  the only difference between the menus is the title of each, MENU1, MENU2, MENU3.

it should work for you.
ASKER CERTIFIED SOLUTION
Avatar of 1cell
1cell
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks,
I should be able to apply this to my page.  Wish me luck.
maddy
hey, glad I could help!  normally, I am the one getting helped in this category but I understood what you wanted and had a few examples to pull from.

good luck!