Link to home
Start Free TrialLog in
Avatar of JAMES
JAMES

asked on

Keeping window.createPopup( ) on top even if user clicks outside

Hi,

We very happily use window.createPopup to display status messages before various windows load which works very well until the user clicks away from the message - this, of course, closes it.

Is there anyway we can keep this message "on top" until we ".hide" it, regardless of where on the page the user clicks?

Thanks.

James.
Avatar of alain34
alain34
Flag of United Kingdom of Great Britain and Northern Ireland image

If don't know what the function createPopup does, but if you have a body tag in the popup produced hopefully in html, add <body onBlur='self.focus();'>"
Avatar of Michel Plungjan
I doubt it since that is what it does

use
showModalDialog('page.html',window,'dialogHeight:100px; dialogWidth:200px')
instead

Here is the documentation
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/createpopup.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp
Avatar of JAMES
JAMES

ASKER

alain,

Thanks but that doesnt work.

M,

Thanks also but I dont want to use showModalDialog.

could you post your code to enable people to help better!
Avatar of JAMES

ASKER

Here it is :-

      var oPopup = window.createPopup();
      var oPopBody = oPopup.document.body;
      oPopBody.style.backgroundColor = "lightyellow";
      oPopBody.style.border = "solid black 1px";
      oPopBody.innerHTML = "<CENTER><FONT FACE=Tahoma Size=2>Please wait...</FONT><IMG src='images/Hourglass.gif'></CENTER></BODY>";
      oPopup.show((window.screen.availWidth / 2) - 90, (window.screen.availHeight / 2) - 80, 180, 20, document.body);

James.
My idea would be to have an interval lookup for the popup property isOpen
If isOpen is fals and your hide time is not reached, then simply reopen the popup.
Avatar of JAMES

ASKER

Is there a way of trapping the click event elsewhere in the underlying page and then checking the IsOpen property?
How about a simulated popup?
http://kiddanger.com/lab/divmsg.html
Why on earth the VBSCRIPT?
It would work just as well with javascript and then in all dom browsers
I'm sure you can do a dhtml popup in javascript
http://web-developer.boeldt.net/Cool_DHTML_PopUp.asp
Yes, there is an event handler for body onClick that you could use for that purposes.
Avatar of JAMES

ASKER

mplungjan,

What VBScript?
JAMES, mplungian is mentioning that the solution proposed by kiddanger is produced by vbscript code, and it is not cross browser compatible!
Avatar of JAMES

ASKER

"Yes, there is an event handler for body onClick that you could use for that purposes."

So where would I place the handler?
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JAMES

ASKER

Nice one Zvonko,

Works a treat!

Thanks.

James.
:-)
By the way, did you see this: http://www.ferant.com/samples/sample1.aspx
They provide also the C# source for that popups for $299.
Ah, you guys kill me.  (O:=

mplungjan...

It was apparent, at least to me, the author wanted an IE ONLY solution since they were looking at createPopup which is NOT cross-browser compatible.

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/createpopup.asp

Read the part listed under 'standards information' and then 'applies to'.

Now look at showModalDialog:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/showmodaldialog.asp

Read the part listed under 'standards information' and then 'applies to'.

Then look at createElement:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/createelement.asp

And again at 'standards information' and then 'applies to'.

Then ask me again about vbscript which also only works in IE on the client-side.  Perhaps there are some benefits of research and to test your code before offering it as a solution.

Here is a showModalDialog script that works in IE, but not in FF because it's not cross-browser compatible.
http://kiddanger.com/lab/modal.html

I changed my routine to javascript to be cross-browser compatible.  It has a small CSS issue but works otherwise.

Don't let the nick fool ya'.

Zvonko...
Here's your code.  It doesn't work in FireFox.  It appears the discussion is a desire for cross-browser compatibility which your code fails to meet.

http://kiddanger.com/lab/thiswillnotworkinff.html

Cheers boys!
Did anybody ask for FireFox? :-)
kiddanger, I am happy to see new Experts bringing back the exchange spirit of our community. But please be careful interpreting the requirements of the asker.
In this particular question I know personally the asker and have some advantage in interpreting his needs. :)

ps: your habit to bring EE code to your server remembers me to have to place my copyright notice in my code ;-)
Avatar of JAMES

ASKER

Thanks everyone for your help but it's now closed!

Kiddangers observations are correct and that an IE only solution is fine.

Zvonko's solution works very well and suits our needs (as most solutions he provides ;-))

James.
Sorry for the banter in your question. We can continue this elsewhere
Zvonko...

No need for copyright but no problem if you do.  I write my own stuff.  I usually go through and clean out others often.  I usually put in references in the code where I found it even if there isn't one so I don't forget.  Anyway, it's deleted.

I would agree on the interpreting but this would pretty clear "We very happily use window.createPopup..." Jes' sayin' (O:=

I've seen your posts and can see why the askers are pleased with your responses.

James...

I was merely responding to the references to my code.

Thanks guys.
Not a problem at all kiddanger.
Anyway I had in mind more a copyleft then copyright notice ;-)
I have learned so much from internet that I am happy from anyone seeing a learning value in my examples.