justinfancy
01-25-2012, 07:12 PM
Hi Guys,
I am designing a web page that will include a nice javascript hover over drop down list. I have three files; js file, html file, and a css file. In chrome, it looks beautiful, and in Firefox it looks beautiful, but in IE, there are some alignment issues. Could someone please assist? Here is the code:
HTML File:
=======================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="dropdown.js"></script>
<link rel="stylesheet" href="dropdown.css" type="text/css" />
<title>
HYFLODRAULIC
</title>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
<style>
a{text-decoration:none;}
</style>
<style>
a:hover{color:67c5b5;}
</style>
</head>
<body text=#ffffff vLink=0088771 aLink=008871 link=008871 background="images\background.jpg"
leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<p align="center">
<a href="index.html">
<IMG alt="welcome to www.hyflodraulic.ca" src="images\siteheader.jpg" height=213 width=950 vspace=10 border=0>
</a>
<table cellSpacing=0 cellPadding=0 width=950 align="center" bgColor=ffffff border=0>
<table cellSpacing=1 cellPadding=1 width=950 align="center" bgColor=000000 border=0>
<tr align="center" bgcolor=ffffff>
<td align="center">
<table align="center" cellSpacing=0 cellPadding=0 width=950 border=0>
<font size=2 face=arial narrow>
<td align="left"%>
<font size=2 face=arial narrow color=3f3d3e>
<dl class="dropdown">
<dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)">Company</dt>
<dd id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)">
<ul>
<li><a href="#" class="underline">Services</a></li>
<li><a href="#" class="underline">Facilities</a></li>
<li><a href="#" class="underline">Affiliations</a></li>
<li><a href="#" class="underline">Team</a></li>
</ul>
</dd>
</dl>
<dl class="dropdown">
<dt id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)">Projects</dt>
<dd id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)">
<ul>
<li><a href="#" class="underline">Current Projects</a></li>
<li><a href="#" class="underline">Recent Projects</a></li>
<li><a href="#" class="underline">Past Projects</a></li>
</ul>
</dd>
</dl>
<dl class="dropdown">
<dt id="three-ddheader" onmouseover="ddMenu('three',1)" onmouseout="ddMenu('three',-1)">News</dt>
<dd id="three-ddcontent" onmouseover="cancelHide('three')" onmouseout="ddMenu('three',-1)">
<ul>
<li><a href="#" class="underline">News Item 1</a></li>
<li><a href="#" class="underline">News Item 2</a></li>
<li><a href="#" class="underline">News Item 3</a></li>
</ul>
</dd>
</dl>
</dl>
<dl class="dropdown">
<dt id="four-ddheader" onmouseover="ddMenu('four',1)" onmouseout="ddMenu('four',-1)">Services</dt>
<dd id="four-ddcontent" onmouseover="cancelHide('four')" onmouseout="ddMenu('four',-1)">
<ul>
<li><a href="#" class="underline">Services Page 1</a></li>
<li><a href="#" class="underline">Services Page 2</a></li>
<li><a href="#" class="underline">Services Page 3</a></li>
</ul>
</dd>
</dl>
<dl class="dropdown">
<dt id="five-ddheader" onmouseover="ddMenu('five',1)" onmouseout="ddMenu('five',-1)">Careers</dt>
<dd id="five-ddcontent" onmouseover="cancelHide('five')" onmouseout="ddMenu('five',-1)">
<ul>
<li><a href="#" class="underline">Working For Us</a></li>
<li><a href="#" class="underline">Current Opportunities</a></li>
</ul>
</dd>
</dl>
<div style="clear:both" />
<br>
<!--**********************insert content here***********************************-->
<b>HYFLODRAULIC Site content would start here.... </b>
<p>
Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla
Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla
Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla
<!--end content here-->
</td>
</tr>
</tbody>
</table>
<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table width=953 align="center">
<img src="images\glowglobe.jpg">
<tr>
<td width="945" align="right">
<font face=verdana size=1>
<b>
<center>
Hyflodraulic Limited |
48 Clyde Avenue |
Donovan’s Industrial Park |
Mount Pearl, NL |
A1N 4S1 |
Tel: 709-364-5566 |
Fax: 709-364-8215 |
<a href="www.hyflodraulic.ca">www.hyflodraulic.ca
</center>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
========================================================
JS File:
========================================================
var DDSPEED = 10;
var DDTIMER = 15;
// main function to handle the mouse events //
function ddMenu(id,d){
var h = document.getElementById(id + '-ddheader');
var c = document.getElementById(id + '-ddcontent');
clearInterval(c.timer);
if(d == 1){
clearTimeout(h.timer);
if(c.maxh && c.maxh <= c.offsetHeight){return}
else if(!c.maxh){
c.style.display = 'block';
c.style.height = 'auto';
c.maxh = c.offsetHeight;
c.style.height = '0px';
}
c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
}else{
h.timer = setTimeout(function(){ddCollapse(c)},50);
}
}
// collapse the menu //
function ddCollapse(c){
c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}
// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
var h = document.getElementById(id + '-ddheader');
var c = document.getElementById(id + '-ddcontent');
clearTimeout(h.timer);
clearInterval(c.timer);
if(c.offsetHeight < c.maxh){
c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
}
}
// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
var currh = c.offsetHeight;
var dist;
if(d == 1){
dist = (Math.round((c.maxh - currh) / DDSPEED));
}else{
dist = (Math.round(currh / DDSPEED));
}
if(dist <= 1 && d == 1){
dist = 1;
}
c.style.height = currh + (dist * d) + 'px';
c.style.opacity = currh / c.maxh;
c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
clearInterval(c.timer);
}
}
==========================================================
CSS File:
==========================================================
body {margin:25px; font:12px Verdana, Arial, Helvetica}
* {padding:0; margin:0}
.dropdown {float:left; padding-right:0px}
.dropdown dt {width:170px; border:1px solid #ffffff; padding:8px; font-weight:bold; cursor:pointer; background:url(images/header.gif) center}
.dropdown dt:hover {background:url(images/header_over.gif)}
.dropdown dd {position:absolute; overflow:hidden; width:170px; display:none; background:#fff; z-index:500; opacity:0}
.dropdown ul {width:170px; border:2px solid #ffffff; list-style:none; border-top:none}
.dropdown li {display:inline}
.dropdown a, .dropdown a:active, .dropdown a:visited {display:block; padding:5px; color:#333; text-decoration:none; background:#eaf0f2; width:170px}
.dropdown a:hover {background:#d9e1e4; color:#000}
.dropdown .underline {border-bottom:1px solid #ffffff}
==========================================================
I hope someone can figure this out! It is so greatly appreciated. Thanks for your time.
Justin Fancy
St. John's, Newfoundland
I am designing a web page that will include a nice javascript hover over drop down list. I have three files; js file, html file, and a css file. In chrome, it looks beautiful, and in Firefox it looks beautiful, but in IE, there are some alignment issues. Could someone please assist? Here is the code:
HTML File:
=======================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="dropdown.js"></script>
<link rel="stylesheet" href="dropdown.css" type="text/css" />
<title>
HYFLODRAULIC
</title>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
<style>
a{text-decoration:none;}
</style>
<style>
a:hover{color:67c5b5;}
</style>
</head>
<body text=#ffffff vLink=0088771 aLink=008871 link=008871 background="images\background.jpg"
leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<p align="center">
<a href="index.html">
<IMG alt="welcome to www.hyflodraulic.ca" src="images\siteheader.jpg" height=213 width=950 vspace=10 border=0>
</a>
<table cellSpacing=0 cellPadding=0 width=950 align="center" bgColor=ffffff border=0>
<table cellSpacing=1 cellPadding=1 width=950 align="center" bgColor=000000 border=0>
<tr align="center" bgcolor=ffffff>
<td align="center">
<table align="center" cellSpacing=0 cellPadding=0 width=950 border=0>
<font size=2 face=arial narrow>
<td align="left"%>
<font size=2 face=arial narrow color=3f3d3e>
<dl class="dropdown">
<dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)">Company</dt>
<dd id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)">
<ul>
<li><a href="#" class="underline">Services</a></li>
<li><a href="#" class="underline">Facilities</a></li>
<li><a href="#" class="underline">Affiliations</a></li>
<li><a href="#" class="underline">Team</a></li>
</ul>
</dd>
</dl>
<dl class="dropdown">
<dt id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)">Projects</dt>
<dd id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)">
<ul>
<li><a href="#" class="underline">Current Projects</a></li>
<li><a href="#" class="underline">Recent Projects</a></li>
<li><a href="#" class="underline">Past Projects</a></li>
</ul>
</dd>
</dl>
<dl class="dropdown">
<dt id="three-ddheader" onmouseover="ddMenu('three',1)" onmouseout="ddMenu('three',-1)">News</dt>
<dd id="three-ddcontent" onmouseover="cancelHide('three')" onmouseout="ddMenu('three',-1)">
<ul>
<li><a href="#" class="underline">News Item 1</a></li>
<li><a href="#" class="underline">News Item 2</a></li>
<li><a href="#" class="underline">News Item 3</a></li>
</ul>
</dd>
</dl>
</dl>
<dl class="dropdown">
<dt id="four-ddheader" onmouseover="ddMenu('four',1)" onmouseout="ddMenu('four',-1)">Services</dt>
<dd id="four-ddcontent" onmouseover="cancelHide('four')" onmouseout="ddMenu('four',-1)">
<ul>
<li><a href="#" class="underline">Services Page 1</a></li>
<li><a href="#" class="underline">Services Page 2</a></li>
<li><a href="#" class="underline">Services Page 3</a></li>
</ul>
</dd>
</dl>
<dl class="dropdown">
<dt id="five-ddheader" onmouseover="ddMenu('five',1)" onmouseout="ddMenu('five',-1)">Careers</dt>
<dd id="five-ddcontent" onmouseover="cancelHide('five')" onmouseout="ddMenu('five',-1)">
<ul>
<li><a href="#" class="underline">Working For Us</a></li>
<li><a href="#" class="underline">Current Opportunities</a></li>
</ul>
</dd>
</dl>
<div style="clear:both" />
<br>
<!--**********************insert content here***********************************-->
<b>HYFLODRAULIC Site content would start here.... </b>
<p>
Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla
Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla
Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla Bla bla bla bla
<!--end content here-->
</td>
</tr>
</tbody>
</table>
<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table width=953 align="center">
<img src="images\glowglobe.jpg">
<tr>
<td width="945" align="right">
<font face=verdana size=1>
<b>
<center>
Hyflodraulic Limited |
48 Clyde Avenue |
Donovan’s Industrial Park |
Mount Pearl, NL |
A1N 4S1 |
Tel: 709-364-5566 |
Fax: 709-364-8215 |
<a href="www.hyflodraulic.ca">www.hyflodraulic.ca
</center>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
========================================================
JS File:
========================================================
var DDSPEED = 10;
var DDTIMER = 15;
// main function to handle the mouse events //
function ddMenu(id,d){
var h = document.getElementById(id + '-ddheader');
var c = document.getElementById(id + '-ddcontent');
clearInterval(c.timer);
if(d == 1){
clearTimeout(h.timer);
if(c.maxh && c.maxh <= c.offsetHeight){return}
else if(!c.maxh){
c.style.display = 'block';
c.style.height = 'auto';
c.maxh = c.offsetHeight;
c.style.height = '0px';
}
c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
}else{
h.timer = setTimeout(function(){ddCollapse(c)},50);
}
}
// collapse the menu //
function ddCollapse(c){
c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}
// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
var h = document.getElementById(id + '-ddheader');
var c = document.getElementById(id + '-ddcontent');
clearTimeout(h.timer);
clearInterval(c.timer);
if(c.offsetHeight < c.maxh){
c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
}
}
// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
var currh = c.offsetHeight;
var dist;
if(d == 1){
dist = (Math.round((c.maxh - currh) / DDSPEED));
}else{
dist = (Math.round(currh / DDSPEED));
}
if(dist <= 1 && d == 1){
dist = 1;
}
c.style.height = currh + (dist * d) + 'px';
c.style.opacity = currh / c.maxh;
c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
clearInterval(c.timer);
}
}
==========================================================
CSS File:
==========================================================
body {margin:25px; font:12px Verdana, Arial, Helvetica}
* {padding:0; margin:0}
.dropdown {float:left; padding-right:0px}
.dropdown dt {width:170px; border:1px solid #ffffff; padding:8px; font-weight:bold; cursor:pointer; background:url(images/header.gif) center}
.dropdown dt:hover {background:url(images/header_over.gif)}
.dropdown dd {position:absolute; overflow:hidden; width:170px; display:none; background:#fff; z-index:500; opacity:0}
.dropdown ul {width:170px; border:2px solid #ffffff; list-style:none; border-top:none}
.dropdown li {display:inline}
.dropdown a, .dropdown a:active, .dropdown a:visited {display:block; padding:5px; color:#333; text-decoration:none; background:#eaf0f2; width:170px}
.dropdown a:hover {background:#d9e1e4; color:#000}
.dropdown .underline {border-bottom:1px solid #ffffff}
==========================================================
I hope someone can figure this out! It is so greatly appreciated. Thanks for your time.
Justin Fancy
St. John's, Newfoundland