Forum Moderators: open

Message Too Old, No Replies

Problem with popup window and HierMenus

         

kevinj

10:53 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



I have a client who has a Javascript popup window that opens in the body tag when users come to the homepage. The popup window is to draw visitors attention to apply to perform at their convention. It is not a 3rd party popup advertisement. I'm using HierMenus for the submenus. The problem is that when the onLoad is called in the body tag, it appears that the menus aren't loaded completely. When I close the popup window. The home page does not display the hiermenus. Is there a way to make sure the whole page loads and the hiermenus get loaded too? Any thoughts?

Thanks,
Kevin

isitreal

11:42 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try using setTimeOut() on the popup menu to give the submenus time to load, 100 milliseconds or so should be enough time.

Purple Martin

12:45 am on Feb 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A simple timeout is good, and will work for most machines, but might miss slow machines.

You can enhance the timeout trick to make sure the menus really are loaded.

Declare a variable outside all functions (so it is global):
var menuLoaded = false;

Then right at the end of the functions that load the menus, set it to true:
menuLoaded = true;

Now make new a function that gets called by the body onLoad event:
function waitUntilReady() {
if (menuLoaded) {
doPopup() // the menus are ready so call the popup function
} else {
setTimeout("waitUntilReady()",100) // try again in 0.1 seconds
}

kevinj

1:33 am on Feb 13, 2004 (gmt 0)

10+ Year Member



I now have the menu loading and the popup window, but the popup window in Windows minimizes and doesn't display over the home page.

midwestclinic.org/conferenceinfo2.asp

I have a call and the end of the menuloader to another js page which contains the following code:

openPopWin("http://www.midwestclinic.org/perf_popup.html", 400, 200, "", 20,
200)
<!--
// Copyright 1999 - 2002 by Ray Stott, Pop-up Windows Script ver 2.0 // OK to use if this copyright is included // Script is available at [crays.com...]
var popWin = null // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
var d_winLeft = 350 // default, pixels from screen left to window left
var d_winTop = 150 // default, pixels from screen top to window top
winName = "popWin" + winCount++ //unique name for each pop-up window
closePopWin() // close any previously opened pop-up window
if (openPopWin.arguments.length >= 4) // any additional features?
winFeatures = "," + winFeatures
else
winFeatures = ""
if (openPopWin.arguments.length == 6) // location specified
winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
else
winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
popWin = window.open(winURL, winName, "width=" + winWidth
+ ",height=" + winHeight + winFeatures)
}

Any way to keep the popup window displayed over the main page and not minimized to the toolbar?

Thanks,
Kevin

kevinj

2:27 pm on Feb 13, 2004 (gmt 0)

10+ Year Member



Disregard last post. It's working fine. It was a setting in my IE.

Thanks Purple Martin and Real.

Kevin