Click to See Complete Forum and Search --> : menu over framed page


reaganp1
03-27-2003, 03:06 PM
I am using the following code to display a popup menu over a frame.
The menu links work but display's it on the topFrame where the menu is located. I need it to display in mainFrame.

Can anyone give me any suggestion

Thanks in advance
Reagan



<A HREF="#" ONCLICK="showMenu(this,submenu)">Main Menu</A>

<TABLE CLASS=menu ID=submenu>
<TR><TD NOWRAP>
<A HREF="http://www.invest.com" TARGET="parent.mainFrame">Home</A>
</TD></TR>
<TR><TD NOWRAP>
<A HREF="http://www.yahoo.com" target="content">Jobs</A>
</TD></TR>
<TR><TD NOWRAP>...</TD></TR>
</TABLE>


<SCRIPT>
var oPopup = window.createPopup();

function getA(el) {
while (el!=null) {
if (el.tagName=="A") return el
el = el.parentElement
}
return null
}

function doClick() {
//window.open("http://www.invest.com" target=mainFrame);
//}
// Get the event object of the popup window
var ev = this.document.parentWindow.event

// If a link, set the location of the current window
// We use a smart test that looks for a link anywhere
// above the clicked item. This allows additional
// formatting tags within the link. (eg., B, I, etc.)
var el = getA(ev.srcElement)
if (el)
self.location = el.href
//self.location = "http://localhost/jscript/frame.htm"
}

function showMenu(e,menu) {
var oPopupBody = oPopup.document.body;
oPopupBody.style.border = "1px black solid"
oPopupBody.innerHTML = menu.outerHTML
oPopupBody.onclick = doClick
oPopup.show(0, e.offsetHeight, menu.offsetWidth, menu.offsetHeight,e)
}

</SCRIPT>

b3nj
03-27-2003, 04:30 PM
Sorry I won't help.

I have the same problem: making the links go in another frame than the frame where the drop down menu is. I tried to put a "target" but it doesn't work. The code just ignore it and load the link where he is, in the main frame (I called it "Frame menu").

I took the code from this Web site, so can any admin help? Here it is:

- - - - - - - - - - - - - - - - - - - - - - - - - - -

<form name="jump">
<select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
<option value="http://www.google.com">Link1</option>
<option value="http://www.google.com" target="Frame sub-menu">Link2</option>
</select>
</form>

- - - - - - - - - - - - - - - - - - - - - - - - - - -

Thanks a lot!

reaganp1
03-28-2003, 05:51 PM
Well I think I got it working

If anything it is a good start

This page below is the topNav
give it a try

I got it from
http://www.siteexperts.com/ie5/tips/ts02/page2.asp

good luck


<!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 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<SCRIPT language="JavaScript">
var oPopup = window.createPopup();

function getA(el) {
while (el!=null) {
if (el.tagName=="A") return el
el = el.parentElement
}
return null
}

function doClick() {
self.location = "http://localhost/jscript/frame.htm"
}

function showMenu(e,menu) {
var oPopupBody = oPopup.document.body;
oPopupBody.style.border = "1px black solid"
oPopupBody.innerHTML = menu.outerHTML
oPopupBody.onclick = doClick
oPopup.show(0, e.offsetHeight, menu.offsetWidth, menu.offsetHeight,e)
}

function turnoff(){
setTimeout("oPopup.hide()",5000);
}
</SCRIPT>



<table width="100%" height="82" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td width="230" height="62"><img src="../images/LiveTradeLogo.png" width="138" height="52"></td>
<td valign="bottom"> <table width="100%" height="61" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150" rowspan="2" valign="bottom"><a href="javascript:disp(4),changeImage(4);"><img src="../images/menu/sitemap.gif" name="Image7" width="79" height="25" border="0"></a><a href="../Login.cfm" target="_parent"><img src="../images/menu/logoff.gif" name="Image9" width="71" height="25" border="0"></a></td>
<td height="46"> <div align="right"></div>
<br> </td>
</tr>
<tr>
<td height="15" bgcolor="#666699"><div align="right"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><strong><font size="1"><cfoutput>#DateFormat(NOW()+1,"mmmmmmmmmm / dd / yyyy")#</cfoutput></font><font color="#000000"></font></strong></font><font color="#666699" size="1">__&nbsp;</font></div></td>
</tr>
</table></tr>
<tr bgcolor="#000000">
<td height="6">&nbsp;</td>
<td height="6"><div align="left"><a href="#" onMouseOver="showMenu(this,submenu)" onMouseOut="turnoff()"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Main
Menu</font></a> <a href="#" onClick="showMenu(this,submenu2)"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Main
Menu2</font></a></div></td>
</tr>
</table>

<table class=menu id=submenu>
<tr>
<td nowrap> <a href="reslt.thm" target="parent.mainFrame">Home</a><br>
<span onClick="top.frames[1].frames[1].location.href='chart.cfm'"><img src="" width="130" height="92">
</span> </td>
</tr>
<tr>
<td nowrap> <a href="http://www.yahoo.com" target="content">Jobs</a> </td>
</tr>
<tr>
<td nowrap>...<a href="#"><img src="" alt="" name="a" width="13" height="13" border="0"></a></td>
</tr>
</table>


<table bgcolor="#006666" class=menu id=submenu2>
<tr>
<td nowrap> <a href="reslt.thm" target="parent.mainFrame">Home</a><br>
<span onClick="top.frames[1].location.href='Document1.PDF' "><img src="" width="130" height="92">
</span> </td>
</tr>
<tr>
<td nowrap> <a href="http://www.yahoo.com" target="content">Jobs</a> </td>
</tr>
<tr>
<td nowrap>...</td>
</tr>
</table>
</body>
</html>