| | |
Floting menu for Browser compatibility
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 9
Reputation:
Solved Threads: 0
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"> </td>
<td width="213"> </td>
</tr>
<tr>
<td height="800"> </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>
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"> </td>
<td width="213"> </td>
</tr>
<tr>
<td height="800"> </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>
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Validate dropdown and some other
- Next Thread: Password field
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate array automatically beta box bug calendar cart checkbox child class codes column createrange() css cursor date debugger decimal design disablefirebug dom download dropdown editor element engine enter error explorer file firefox focus forms frameworks getselection google gwt html htmlform ie8 iframe images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp jump listbox maps masterpage math menu microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent php player post problem programming progressbar prototype redirect regex runtime safari scale scriptlets scroll search select shopping size sql text textarea toggle w3c web website window windowofwords windowsxp wysiwyg \n





