Hi all,

Please help me in floating menu. I need this floating function should floting in table td. And should work in all browser. plz help me out soon. Below i have pasted javascript.

Thanks
Raj

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>


<body>
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="790" height="90">&nbsp;</td>
<td width="213">&nbsp;</td>
</tr>
<tr>
<td height="800">&nbsp;</td>
<td valign="top">
<DIV id=divMenu style="VISIBILITY: visible; WIDTH: 10px; POSITION: absolute; TOP: 10px; HEIGHT: 10px">
<table>
<tr>
<td >
INsert_your_Object Here_Here
</td>
</tr>
</table>
<SCRIPT language="JavaScript">
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";
function getRef(id)
{
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}


function moveRightEdge()
{
var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck ;
if (isNS4)
{
yMenuFrom   = divMenu.top;
yMenuTo     = windows.pageYOffset + 137;
}
else if (isDOM)
{
yMenuFrom   = parseInt (divMenu.style.top, 10);
yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 30;
//Specify the distance of the  Floating Object from top.
}   timeoutNextCheck = 50;
if (yMenuFrom != yMenuTo)
{


yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
//Specify the floating Speed high=0,slow=500. etc
if (yMenuTo < yMenuFrom)
yOffset = -yOffset;
if (isNS4)
divMenu.top += yOffset;
else if (isDOM)
divMenu.style.left =  120;
//Specifies the distance of the floating object from left.
divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
timeoutNextCheck = 0; //Specifies the speed of reaction .
}
setTimeout ("moveRightEdge()", timeoutNextCheck);}
if (isNS4) {    var divMenu = document["divMenu"];
divMenu.top = top.pageYOffset + 0;
divMenu.visibility = "visible";
moveRightEdge();
}
else if (isDOM)
{
var divMenu = getRef('divMenu');
divMenu.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 0;
divMenu.style.visibility = "visible";   moveRightEdge();
}
</SCRIPT>
</DIV>


</td>
</tr>
</table>


</body>
</html>

Recommended Answers

All 2 Replies

The script work perfect . no error. What do you want??

this script is not working in firefox lawrendc. could u help me out to get to work in other browsers also

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.