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=http://www.webdeveloper.com/forum/archive/index.php/"#" 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>
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=http://www.webdeveloper.com/forum/archive/index.php/"#" 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>