I can get the menu to appear, but I cannot seem to find a reliable method of hiding it again. Because the menu appears on top of an iframe element, I cannot seem to use the onmouseout event of the menu. So, I have tried to use the onmouseout of the body element of the child window (ie: the popup menu), checking to see whether the current mouse XY coords are within the table, and otherwise call a function in the parent window to set the display of the menu to none. However, this event does not always seem to be fired. I have posted the html for the 2 files below; home2.htm is the parent which opens menu.htm in the same directory:
Move the mouse over the 'trend analysis' on the left hand side to open the menu.
home2.htm ........
<TITLE>CWAFS Information Site</TITLE>
<HEAD>
<SCRIPT language="vbscript">
Option Explicit
Const giMBOX_INFO_OK = 64
Const giMBOX_ASK_YESNO = 36
Const gsMBOX_TITLE = "OLAP Development"
Dim iLastOption
Dim objCurDataFrame
Dim iElements
'************************************************************
'************ this is the relevant code for the popup menu...
Sub shwpopupmenu(iCell, iOption)
tblPopup1.Style.Display = ""
tblPopup1.Style.PosLeft = tdTemp10.OffSetLeft
tblPopup1.Style.PosTop = tdTemp10.OffSetTop + tdTemp10.OffSetHeight
End Sub
Function iHidePopupMenu
tblPopup1.Style.Display = "none"
iHidePopupMenu = 1
End Function
'************************************************************
'************************************************************
Sub ChgBGColor(iCell, iOption)
Dim sColor
' On Error Resume Next
If iCell = iLastOption Then Exit Sub
If iOption = 0 Then sColor = "#DC143C" Else sColor = "#336699"
tblOptions.Rows(0).Cells(iCell).BGColor = sColor
if icell = 10 then Call shwpopupmenu(icell, ioption)
End Sub
Sub imgSwapMenu_OnClick
Dim sSrc
On Error Resume Next
tblFrame.Style.Display = "NONE"
sSrc = Document.All.frameMain.Src
Document.All.frameMain.Src = ""
Document.All.frameMain1.Src = sSrc
tblFrame1.Style.Display = ""
tblNewMenu.Style.Display = ""
Set objCurDataFrame = Document.All.frameMain1
End Sub
Sub tdResetMenu_OnClick
Dim sSrc
On Error Resume Next
sSrc = Document.All.frameMain1.Src
Document.All.frameMain1.Src = ""
Document.All.frameMain.Src = sSrc
tblFrame1.Style.Display = "NONE"
tblFrame.Style.Display = ""
tblNewMenu.Style.Display = "NONE"
Set objCurDataFrame = Document.All.frameMain
End Sub
Sub Window_OnLoad
On Error Resume Next
iLastOption = 0
tdDefaultMonth.InnerText = "Default month is " & MonthName(Month(Now), True) & CStr(Year(Now))
Set objCurDataFrame = Document.All.frameMain
iElements = Document.All.Length - 1
End Sub
Sub OptionRef_Click(riOption)
On Error Resume Next
Document.All.frameMain.Scrolling = "NO"
Select Case riOption
Case 0
objCurDataFrame.Src = "glossary2.asp"
Case 1
objCurDataFrame.Src = "posttext.asp"
Case 2
Document.All.frameMain.Scrolling = "YES"
objCurDataFrame.Src = "viewtext.asp"
Case 3
objCurDataFrame.Src = "siteadmin.asp"
Case 4
objCurDataFrame.Src = "contactus.asp"
Case 5
objCurDataFrame.Src = "top20.asp"
Case 6
Document.URL = "map1.asp"
End Select
End Sub
Sub TabOptionClick(iOption)
On Error Resume Next
If iLastOption = iOption Then Exit Sub
tblOptions.Rows(0).Cells(iOption).BGColor = "#DC143C"
tblOptions.Rows(0).Cells(iLastOption).BGColor = "#336699"
iLastOption = iOption
Select Case iOption
Case 0
Document.All.frameMain.Scrolling = "NO"
objCurDataFrame.Src = "top20.asp"
Case 2
Document.All.frameMain.Scrolling = "NO"
objCurDataFrame.Src = "bmpstat.asp"
Case 4
Document.All.frameMain.Scrolling = "NO"
objCurDataFrame.Src =