Hi I have two problems actually, I'd be happy for insight into either.
#1
I am trying to get a div to show and hide with a mouseOver. I have put a condition in so if it's netscape it does one things, IE another.
It doesn't work in either and i am stumped.
thanks in advance.
S
here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT LANGUAGE=JavaScript>
function show() {
if(Netscape)
document.layername.visibility = "visible";
else
layername.style.visibility = "visible";
}
function hide() {
if(Netscape)
document.layername.visibility = "hidden";
else
layername.style.visibility = "hidden";
}
</script>
<title>Untitled</title>
<meta name="generator" content="BBEdit 7.0.4" />
</head>
<body>
<DIV ID="layername" style="position:absolute; visibility:hidden; left:250px; top:50px;">Content of Layer Here</DIV>
<a href="*" onMouseOver="show();">show my layer</a><br><br>
<a href="*" onMouseOver="hide();">hide my layer</a><br><br>
</body>
</html>
_____________________________________________
#2
having a problem with cross browser div layer visibility. The following works like a dream in Explorer, but not Netscape. The secondary nav does not become visible when you mouse over the main nav. I have read about this and i realize that NN doesn't like 'visible' but prefers 'hide' and 'show' among other things.
is there an easy way to adapt the foloowing to make it work in NN as well? I am mostly concerned with NN5 and up as i know NN4 is another pandoras box of problems...
If there is an easy solution that would be great, it is worth $$ to me, so if you can accept paypal that will be easy...
here is a link: http://www.dev-area.com/browser/index.html
here are snippets of the code:
--------------------------------------
first level nav:
<div id="top1" style="position:absolute; top:22px; left:270px; z-index:1;">
<a class="nav" onMouseOver="closeAll(); changeDiv('divOne','visible'); return true;"><img src="images/about_us.gif" border="0"></a>
</div>
second level nav:
<!-- ABOUT US -->
<div id="divOne" style="position:absolute; top:50; left:25; visibility:hidden;">
<a class="nav" href="why.html" Target="_top"
onMOUSEOVER="changeImages('a_why', 'images/a_why2.gif'); return true;" onMOUSEOUT="changeImages('a_why', 'images/a_why.gif'); return true;">
<IMG NAME="a_why" SRC="images/a_why.gif" border="0"></a>___
<a class="nav" href="news.html" Target="_top"
onMOUSEOVER="changeImages('news', 'images/news2.gif'); return true;" onMOUSEOUT="changeImages('news', 'images/news.gif'); return true;">
<IMG NAME="news" SRC="images/news.gif" border="0"></a>___
<a class="nav" href="jobs.html" Target="_top"
onMOUSEOVER="changeImages('jobs', 'images/jobs2.gif'); return true;" onMOUSEOUT="changeImages('jobs', 'images/jobs.gif'); return true;">
<IMG NAME="jobs" SRC="images/jobs.gif" border="0"></a>
</div>
the script:
var div_array = new Array("divOne", "divTwo", "divThree", "divFour", "divFive", "divSix");
function changeDiv(the_div, the_change)
{
if (document.all)
{
div_string = "window.document.all." + the_div + ".style";
} else if (document.layers) {
div_string = "window.document." + the_div;
}
the_div = eval(div_string);
the_div.visibility = the_change;
}
function closeAll()
{
for (var loop=0; loop < div_array.length; loop++)
{
changeDiv(div_array[loop], "hidden");
}
}
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}
var preloadFlag = false;
function preloadImages() {
if (document.images) {
a_why2 = newImage("images/a_why2.gif");
news2 = newImage("images/news2.gif");
jobs2 = newImage("images/jobs2.gif");
friends2 = newImage("images/friends2.gif");
green2 = newImage("images/green2.gif");
manufacturing2 = newImage("images/manufacturing2.gif");
view_prod2 = newImage("images/view_prod2.gif");
view_app2 = newImage("images/view_app2.gif");
fabrics2 = newImage("images/fabrics2.gif");
finishes2 = newImage("images/finishes2.gif");
hardware2 = newImage("images/hardware2.gif");
preloadFlag = true;
}
}