Guest_imported
New member
- Jan 1, 1970
- 0
I am using the code below to include a drop-down menu into my site. The problem is that when i add a table into the layer container to display text and graphics the menu displays on mouse-over but wont stay onscreen when the mouse is kept on top of the menu box. In the following example code i have modified the first layer and added a table with links in it........the other layers have been left with the hyperlinks only/no table.......even with these other layers, the mouse must be on the actual links to keep the menu onscreen. Is there a way to keep the menu layer displayed when the mouse is placed anywhere within the menu box?................Can you Please help???
P.S. It must be able to run in both IE6 & netscape 6.2
<html>
<head>
<STYLE>
#layer1 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 10px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer2 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 50px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer3 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 100px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer4 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 140px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer5 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 180px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer6 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 220px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer7 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 270px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer8 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 300px;
position : absolute;
z-index : 90;
visibility : hidden;
}
</STYLE>
<SCRIPT language=javascript>
var activeSub=0;
var SubNum=0;
function reDo(){ window.location.reload() }
window.onresize = reDo;
//Define global variables
var timerID = null;
var timerOn = true;
var timecount = 3000;
var what = null;
var newbrowser = true;
var check = true;
function init(){
// alert ("Running Init"
if (document.layers) {
// alert ("Running Netscape 4"
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
screenSize = window.innerWidth;
what ="ns4";
}else if(document.all){
// alert ("Running IE"
layerRef="document.all";
styleSwitch=".style";
visibleVar="visible";
screenSize = document.body.clientWidth + 18;
what ="ie";
}else if(document.getElementById){
// alert ("Running Netscape 6"
layerRef="document.getElementByID";
styleSwitch=".style";
visibleVar="visible";
what="moz";
}else{
//alert("Older than 4.0 browser."
what="none";
newbrowser = false;
}
window.status='status bar text to go here';
check = true;
}
// Turns the layers on and off
function showLayer(layerName){
if(check){
if (what =="none"{
return;
}
else if (what == "moz"{
document.getElementById(layerName).style.visibility="visible";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
}
else {// alert ("Please wait for the page to finish loading."
return;}
}
function hideLayer(layerName){
if(check){
if (what =="none"{
return;
}
else if (what == "moz"{
document.getElementById(layerName).style.visibility="hidden";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}
}
else {// alert ("Please wait for the page to finish loading."
return;}
}
function hideAll(){
hideLayer('layer1');
hideLayer('layer2');
hideLayer('layer3');
hideLayer('layer4');
hideLayer('layer5');
hideLayer('layer6');
hideLayer('layer7');
hideLayer('layer8');
}
function startTime() {
if (timerOn == false) {
timerID=setTimeout( "hideAll()" , timecount);
timerOn = true;
}
}
function stopTime() {
if (timerOn) {
clearTimeout(timerID);
timerID = null;
timerOn = false;
}
}
function onLoad(){
init();
}
</SCRIPT>
</head>
<body onLoad="init();">
<table border="0" cellpadding="10" width="150" cellspacing="0">
<tr>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer2'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer3'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer4'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer5'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer6'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer7'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer8'); stopTime()" onMouseOut="startTime();">link</a></td>
</tr>
</table>
<div id="layer1">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>
</div>
<div id="layer2">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer3">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer4">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer5">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer6">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer7">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer8">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
</body>
</html>
P.S. It must be able to run in both IE6 & netscape 6.2
<html>
<head>
<STYLE>
#layer1 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 10px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer2 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 50px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer3 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 100px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer4 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 140px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer5 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 180px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer6 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 220px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer7 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 270px;
position : absolute;
z-index : 90;
visibility : hidden;
}
#layer8 {
background-color : #99CCCC;
layer-background-color : #99CCCC;
border-width : 1px;
border-style : solid;
border-color : #006666;
width : 150px;
top : 50px;
left : 300px;
position : absolute;
z-index : 90;
visibility : hidden;
}
</STYLE>
<SCRIPT language=javascript>
var activeSub=0;
var SubNum=0;
function reDo(){ window.location.reload() }
window.onresize = reDo;
//Define global variables
var timerID = null;
var timerOn = true;
var timecount = 3000;
var what = null;
var newbrowser = true;
var check = true;
function init(){
// alert ("Running Init"
if (document.layers) {
// alert ("Running Netscape 4"
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
screenSize = window.innerWidth;
what ="ns4";
}else if(document.all){
// alert ("Running IE"
layerRef="document.all";
styleSwitch=".style";
visibleVar="visible";
screenSize = document.body.clientWidth + 18;
what ="ie";
}else if(document.getElementById){
// alert ("Running Netscape 6"
layerRef="document.getElementByID";
styleSwitch=".style";
visibleVar="visible";
what="moz";
}else{
//alert("Older than 4.0 browser."
what="none";
newbrowser = false;
}
window.status='status bar text to go here';
check = true;
}
// Turns the layers on and off
function showLayer(layerName){
if(check){
if (what =="none"{
return;
}
else if (what == "moz"{
document.getElementById(layerName).style.visibility="visible";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
}
else {// alert ("Please wait for the page to finish loading."
return;}
}
function hideLayer(layerName){
if(check){
if (what =="none"{
return;
}
else if (what == "moz"{
document.getElementById(layerName).style.visibility="hidden";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}
}
else {// alert ("Please wait for the page to finish loading."
return;}
}
function hideAll(){
hideLayer('layer1');
hideLayer('layer2');
hideLayer('layer3');
hideLayer('layer4');
hideLayer('layer5');
hideLayer('layer6');
hideLayer('layer7');
hideLayer('layer8');
}
function startTime() {
if (timerOn == false) {
timerID=setTimeout( "hideAll()" , timecount);
timerOn = true;
}
}
function stopTime() {
if (timerOn) {
clearTimeout(timerID);
timerID = null;
timerOn = false;
}
}
function onLoad(){
init();
}
</SCRIPT>
</head>
<body onLoad="init();">
<table border="0" cellpadding="10" width="150" cellspacing="0">
<tr>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer2'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer3'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer4'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer5'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer6'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer7'); stopTime()" onMouseOut="startTime();">link</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer8'); stopTime()" onMouseOut="startTime();">link</a></td>
</tr>
</table>
<div id="layer1">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
<tr>
<td><font color="#FFFFFF"><a href="#">Test Link</a></font></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>
</div>
<div id="layer2">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer3">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer4">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer5">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer6">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer7">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
<div id="layer8">
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
<a href="#" onMouseOver="stopTime();" onMouseOut="startTime();">nav item</a><br>
</div>
</body>
</html>