472,789 Members | 1,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

PopUp Focus - How To?

Dear Group

I wondered whether you can help me with this. I do have a page that
contains a button and an IFrame. The IFrame contains a dummy page that
is set to redirect to a word document when loaded so eventually the
word document will be displayed in the IFrame. That works all well. No
problem.

The only trouble I have is with the button contained on the parent
page. When pressed, it runs this script:

<script language=JavaScript>
window.open('download.aspx','download','width=320, height=150,resizable=no,scrollbars=no');</script>

which opens a little download window where the word document can be
downloaded to the client. The window opens perfectly fine but always
ends up behind the parent page because the button click unavoidable
reloads the parent page (That's ok) but then triggers the dummy page to
load the document which will give the focus to the paren page. So the
pop-up is only shown for a second in the foreground and then
disappears.
I have tried placing a window.focus(newwindow) script on the dummy page
but then I can't see the pop-up at all. I might do something wrong with
the window.focus script as I'm not so good in Java.
If you have any ideas, please let me know.

Thank you very much for your help & efforts!
Have a nice day!

Martin

Jul 23 '05 #1
13 2011
Ivo
<th************@hotmail.com> wrote
The only trouble I have is with the button contained on the parent
page. When pressed, it runs this script:

<script language=JavaScript>
window.open('download.aspx','download','width=320, height=150,resizable=no,sc
rollbars=no');</script>

Why should your popup be unresizable? There really is no excuse for
disabling this window feature, simply because those visitors that don't try
to resize the window will never notice a difference, and those that do try
it, for whatever unthought of circumstance, will only find that they can't!
Give me one good reason!
which opens a little download window where the word document can be
downloaded to the client. The window opens perfectly fine but always
ends up behind the parent page because the button click unavoidable
reloads the parent page (That's ok)


Haven't seen enough of your code, but I don't see why a reload would
unavoidable. Anyway, to focus the popup from the opener, you need to assign
a reference via the open() statement like so:

var w=window.open( 'stuff', 'stuff', 'stuff' );
w .focus();

hth
--
ivo
Jul 23 '05 #2
In article <11**********************@c13g2000cwb.googlegroups .com>,
th************@hotmail.com enlightened us with...
So the
pop-up is only shown for a second in the foreground and then
disappears.


Did you try: (watch for word-wrap!)

<script type="text/javascript">
// note that the language attribute is deprecated: use type

var w = window.open('download.aspx','download','width=320, height=
150,resizable=no,scrollbars=no');
if (w != null) w.focus();

</script>

--
--
~kaeli~
Jesus saves, Allah protects, and Cthulhu thinks you'd make
a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
theintrepid...@hotmail.com wrote:

(snip)
...the button contained on the parent
page....runs this script:
(snip)
which opens a little download window where the word document can be
downloaded to the client. The window opens perfectly fine but always
ends up behind the parent page because the button click unavoidable
reloads the parent page (That's ok) but then triggers the dummy page to load the document which will give the focus to the paren page. So the
pop-up is only shown for a second in the foreground and then
disappears.


(snip)

Wow, that's as clear as mud. Why does the "button click unavoidable
[sic]
reloads the parent page" ? If it's a <button> button, try this:

<button...onclick="funcName();return false;">

Otherwise, try this in 'download.aspx':

<script type="text/javascript">

self.focus();

</script>

Jul 23 '05 #4
Ivo

First, thanks very much for your reply.
But may you want to have a look out of your box next time before
starting patronizing.
It's an aspx application and if I don't want someone to resize a window
then there's a very good reason for it. And if I say a reload is
unavoidable then this is also carved in stone! You java people and your
attitude. Argh! Anyway, tried your suggestion before and it doesn't
work.

Jul 23 '05 #5
Hi Kaeli

Thanks very much for your help.
Yes I tried that. Even on a simple test page with two buttons. One
opens the popup and the other one gives the focus to it with the code
you suggested. However I always get a variable null error. Thought the
variable is global and should have a value if I did everything like you
say? Any ideas?

Thanks for your efforts!

M

Jul 23 '05 #6
Hi Rob

Thanks for your post!
Well, it's an aspx application that will need to post back when the
button is clicked. It's not just a button but a toolbar control and
that how it works. So everytime the button is clicked it executes the
javascript to open the popup (which will come up for a second) but
because the page reloads it also reloads the frame with the dummy page
that will then reload the word document and the parent page gets the
focus again!

Have tried your suggestion and it doesn't work because the frame reload
happens after the popup comes up so this will be after the popup focus
event has happened. Tried placing a timer in the popup to execute the
javascript after e.g. five seconds (when the frame finished loading)
but still no luck.

Have a nice day!

M

Jul 23 '05 #7

theintrepid...@hotmail.com wrote:
It's an aspx application and if I don't want someone to resize a window then there's a very good reason for it. And if I say a reload is
unavoidable then this is also carved in stone! You java people and your attitude. Argh!


Remember that you have no right on usenet to demand to have your
questions answered under your terms.

Jul 23 '05 #8
God! Are you all human rights activists? Go back play with your Apple
Mac!

Jul 23 '05 #9
God! Are you all human rights activists? Go back play with your Apple
Mac!

Jul 23 '05 #10
theintrepid...@hotmail.com wrote:
Hi Rob

Thanks for your post!
Well, it's an aspx application that will need to post back when the
button is clicked. It's not just a button but a toolbar control and
that how it works. So everytime the button is clicked it executes the
javascript to open the popup (which will come up for a second) but
because the page reloads it also reloads the frame with the dummy page that will then reload the word document and the parent page gets the
focus again!

Have tried your suggestion and it doesn't work because the frame reload happens after the popup comes up so this will be after the popup focus event has happened. Tried placing a timer in the popup to execute the
javascript after e.g. five seconds (when the frame finished loading)
but still no luck.

Have a nice day!

M


Could make that popup a $0.98 modal window:

<script type="text/javascript">

self.onblur = function()
{
setTimeout('self.focus()', 100);
}

</script>

Jul 23 '05 #11
In article <11**********************@g14g2000cwa.googlegroups .com>,
th************@hotmail.com enlightened us with...
Hi Kaeli

Thanks very much for your help.
Yes I tried that. Even on a simple test page with two buttons. One
opens the popup and the other one gives the focus to it with the code
you suggested. However I always get a variable null error. Thought the
variable is global and should have a value if I did everything like you
say? Any ideas?

Thanks for your efforts!


Might be an issue b/c of the reloading going on (which wipes out variable
values). Or might be timing if the document hasn't fully loaded.

You just want the popup to focus when it's loaded, right?

Did you try, in the popup itself (that is, in download.aspx):
<body onload="self.focus();">

--
~kaeli~
Cthulhu saves our souls and redeems them for valuable
coupons later.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #12
Thanks for your message Rob. I havent tried your suggestion but will if
the current one causes problems. I found a workaround by setting a META
refresh and self.focus() in the popup.

Jul 23 '05 #13
Thanks for your message Kaeli.

Yes, that's right! That might be why the variable will be empty!

I found a workaround by setting a META refresh and self.focus() in the
popup.

Have a nice day!

M

Jul 23 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mica Cooper | last post by:
Hi, I have a series of Select menus on a page. I am trying to allow the user to click on the Select title and have it popup a help window. This works fine with the following code except that all...
5
by: Willem van Isselmuden | last post by:
Hello, I've a problem I hava a page with different popup windows, when I hit a link the first one pops up and with the first open i would like to hit the second link in the parent page so the...
2
by: Moist | last post by:
Hi, first I must admit this is one of the most active group I have ever seen. For my question: is it possible to create a small popup window that remain in focus until it is closed. That is,...
2
by: Kevin Lam | last post by:
Hi all, I am writing an application which requires using a popup windows to edit the detail of a record. The popup windows is created by it's parent which shows the detail of the record,...
4
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with...
0
by: Peter Wone | last post by:
I create and position a form containing a popup list la combobox list. When I either Show() it or set popup.Visible = true it steals the focus. I can put the focus right back where it was but the...
0
by: theintrepidfox | last post by:
Dear Group Some would think this works but somehow the Focus Button Click Event comes back with a message saying that WindowObjectReference is either NULL or not an object! Both buttons are...
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.