A
Anthony
I am just learning javascript and have a couple of questions. I would
like to modify this script to do two things:
1. Open the URLs in the useful links menu in a new page
2. Collapse the drop-down menu onMouseout
CASCADE MENU SCRIPT
function highlight(obj)
{
var PElement = eval(obj.parentElement.id)
if(PElement.hasChildNodes() == true)
{ var Elements = PElement.children
for(var i=0;i<Elements.length;i++)
{
TE = eval(Elements.id)
TE.className = "menuItem"
}
}
obj.className="ItemMouseOver"
window.defaultStatus = obj.title
ShowSubMenu(obj)
}
function Do(obj)
{
var cmd = eval(obj).cmd
window.navigate(cmd)
}
function HideMenu(obj)
{
if(obj.hasChildNodes()==true)
{
var child = obj.children
for(var j =0;j<child.length;j++)
{
if (child[j].className=="barOver")
{var bar = eval(child[j].id)
bar.className="Bar"}
if(child[j].menu != null)
{
var childMenu = eval(child[j].menu)
if(childMenu.hasChildNodes()==true)
HideMenu(childMenu)
childMenu.style.visibility = "hidden"
}
}
}
}
function ShowSubMenu(obj)
{
PMenu = eval(obj.parentElement.id)
HideMenu(PMenu)
if(obj.menu != null)
{
var menu = eval(obj.menu)
menu.style.visibility = "visible"
menu.style.pixelTop = obj.getBoundingClientRect().top +
Bdy.scrollTop
menu.style.pixelLeft = obj.getBoundingClientRect().right +
Bdy.scrollLeft
if(menu.getBoundingClientRect().right > window.screen.availWidth )
menu.style.pixelLeft = obj.getBoundingClientRect().left -
menu.offsetWidth
}
}
HTML CODE from FrontPage
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<link href="Cascade Menu/CascadeMenu.css" rel="stylesheet">
<script language="javascript" src="Cascade Menu/CascadeMenu.js">
</script>
<title>Bomber Home Page</title>
<meta name="Microsoft Theme" content="blank 1011">
<meta name="Microsoft Border" content="t, default">
</head>
<body OnLoad="InitMenu()" OnClick="HideMenu(menuBar)" ID="Bdy">
<p> </p>
<div align="left">
<table cellpadding="0" cellspacing="0" width="100%" height="110%">
<!-- MSTableType="layout" -->
<tr>
<td valign="top" colspan="3">
<DIV Id="menuBar" class="menuBar" >
<DIV Id="Bar1" class="Bar" menu="menu1">Jump To</DIV>
<DIV Id="Bar2" class="Bar" menu="menu2">Links</DIV>
</DIV>
<!--MenuItem Definition -->
<div Id="menu1" class="menu">
<div Id="menuItem1_1" class="menuItem" menu="menu3">Stats</div>
<div Id="menuItem1_2" class="menuItem" menu="menu4">Incentives</div>
<div Id="menuItem1_3" class="menuItem"
menu="menu5">Recognition</div>
<div Id="menuItem1_4" class="menuItem" title="Photo Gallery"
cmd="Photos.htm">
Photo Gallery</div>
<div Id="menuItem1_5" class="menuItem" title="Updates"
cmd="Updates.htm">
Updates</div>
<div Id="menuItem1_6" class="menuItem" title="Bonus Login"
cmd="Login.htm">
Bonus Login</div>
</div>
<div Id="menu2" class="menu">
<div Id="menuItem2_1" class="menuItem" title="Help System"
cmd="http://www.safecard.com/NewPGHelp/index.htm">
Help System</div>
<div id="menuItem2_2" class="menuItem" title="Web Station"
cmd="http://204.155.206.198/agentops/">Web Station</div>
<div Id="menuItem2_3" class="menuItem" title="ID Secure"
cmd="http://www.safecard.com/NewPGHelp/programs/pgwhs_programs_ID Secure.htm">
ID Secure</div>
<div Id="menuItem2_4" class="menuItem" title="Bucknuts"
cmd="http://www.bucknuts.com/">
Bucknuts</div>
<div Id="menuItem2_5" class="menuItem" title="Self Service"
cmd="https://sourceselfservice2.ceridian.com/AffinionGroup">
Self Service</div>
<div Id="menuItem2_6" class="menuItem" title="Bravo"
cmd="https://www.bravorewards.net/ip-br/MemberSignOn.jsp">
Bravo</div>
<div Id="menuItem2_7" class="menuItem" title="ID Theft Info"
cmd="http://www.idtheftcenter.org/index.shtml">
ID Theft Info</div>
<div Id="menuItem2_8" class="menuItem" title="Zip Code Finder"
cmd="http://zip4.usps.com/zip4/welcome.jsp">
Zip Code Finder</div>
<div Id="menuItem2_9" class="menuItem" title="MSN"
cmd="http://www.msn.com/">
MSN</div>
<div Id="menuItem2_10" class="menuItem" title="ESPN"
cmd="http://www.espn.go.com">
ESPN</div>
Again, many thanks.
like to modify this script to do two things:
1. Open the URLs in the useful links menu in a new page
2. Collapse the drop-down menu onMouseout
CASCADE MENU SCRIPT
function highlight(obj)
{
var PElement = eval(obj.parentElement.id)
if(PElement.hasChildNodes() == true)
{ var Elements = PElement.children
for(var i=0;i<Elements.length;i++)
{
TE = eval(Elements.id)
TE.className = "menuItem"
}
}
obj.className="ItemMouseOver"
window.defaultStatus = obj.title
ShowSubMenu(obj)
}
function Do(obj)
{
var cmd = eval(obj).cmd
window.navigate(cmd)
}
function HideMenu(obj)
{
if(obj.hasChildNodes()==true)
{
var child = obj.children
for(var j =0;j<child.length;j++)
{
if (child[j].className=="barOver")
{var bar = eval(child[j].id)
bar.className="Bar"}
if(child[j].menu != null)
{
var childMenu = eval(child[j].menu)
if(childMenu.hasChildNodes()==true)
HideMenu(childMenu)
childMenu.style.visibility = "hidden"
}
}
}
}
function ShowSubMenu(obj)
{
PMenu = eval(obj.parentElement.id)
HideMenu(PMenu)
if(obj.menu != null)
{
var menu = eval(obj.menu)
menu.style.visibility = "visible"
menu.style.pixelTop = obj.getBoundingClientRect().top +
Bdy.scrollTop
menu.style.pixelLeft = obj.getBoundingClientRect().right +
Bdy.scrollLeft
if(menu.getBoundingClientRect().right > window.screen.availWidth )
menu.style.pixelLeft = obj.getBoundingClientRect().left -
menu.offsetWidth
}
}
HTML CODE from FrontPage
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<link href="Cascade Menu/CascadeMenu.css" rel="stylesheet">
<script language="javascript" src="Cascade Menu/CascadeMenu.js">
</script>
<title>Bomber Home Page</title>
<meta name="Microsoft Theme" content="blank 1011">
<meta name="Microsoft Border" content="t, default">
</head>
<body OnLoad="InitMenu()" OnClick="HideMenu(menuBar)" ID="Bdy">
<p> </p>
<div align="left">
<table cellpadding="0" cellspacing="0" width="100%" height="110%">
<!-- MSTableType="layout" -->
<tr>
<td valign="top" colspan="3">
<DIV Id="menuBar" class="menuBar" >
<DIV Id="Bar1" class="Bar" menu="menu1">Jump To</DIV>
<DIV Id="Bar2" class="Bar" menu="menu2">Links</DIV>
</DIV>
<!--MenuItem Definition -->
<div Id="menu1" class="menu">
<div Id="menuItem1_1" class="menuItem" menu="menu3">Stats</div>
<div Id="menuItem1_2" class="menuItem" menu="menu4">Incentives</div>
<div Id="menuItem1_3" class="menuItem"
menu="menu5">Recognition</div>
<div Id="menuItem1_4" class="menuItem" title="Photo Gallery"
cmd="Photos.htm">
Photo Gallery</div>
<div Id="menuItem1_5" class="menuItem" title="Updates"
cmd="Updates.htm">
Updates</div>
<div Id="menuItem1_6" class="menuItem" title="Bonus Login"
cmd="Login.htm">
Bonus Login</div>
</div>
<div Id="menu2" class="menu">
<div Id="menuItem2_1" class="menuItem" title="Help System"
cmd="http://www.safecard.com/NewPGHelp/index.htm">
Help System</div>
<div id="menuItem2_2" class="menuItem" title="Web Station"
cmd="http://204.155.206.198/agentops/">Web Station</div>
<div Id="menuItem2_3" class="menuItem" title="ID Secure"
cmd="http://www.safecard.com/NewPGHelp/programs/pgwhs_programs_ID Secure.htm">
ID Secure</div>
<div Id="menuItem2_4" class="menuItem" title="Bucknuts"
cmd="http://www.bucknuts.com/">
Bucknuts</div>
<div Id="menuItem2_5" class="menuItem" title="Self Service"
cmd="https://sourceselfservice2.ceridian.com/AffinionGroup">
Self Service</div>
<div Id="menuItem2_6" class="menuItem" title="Bravo"
cmd="https://www.bravorewards.net/ip-br/MemberSignOn.jsp">
Bravo</div>
<div Id="menuItem2_7" class="menuItem" title="ID Theft Info"
cmd="http://www.idtheftcenter.org/index.shtml">
ID Theft Info</div>
<div Id="menuItem2_8" class="menuItem" title="Zip Code Finder"
cmd="http://zip4.usps.com/zip4/welcome.jsp">
Zip Code Finder</div>
<div Id="menuItem2_9" class="menuItem" title="MSN"
cmd="http://www.msn.com/">
MSN</div>
<div Id="menuItem2_10" class="menuItem" title="ESPN"
cmd="http://www.espn.go.com">
ESPN</div>
Again, many thanks.