473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Pop Window

I've installed the following Javascript on my Web page and it
is working fine. It brings up a little pop up message (not an ad).

<script language="JavaScript"><!--
window1=window.open('sera.html','messageWindow1',' scrollbars=no,width=150,height=245')
//--></script>

I'd like to make the following improvements:

1. I want to control where the pop up window
appears (so it doesn't pop up over the best
part of the page). Is there any way to
specify how many pixels from the top and to
the right that the upper left corner of the
pop up window should appear?
2. I want to make the pop up window remain on top
of the main page until the pop up window is
closed.
3. I want the pop up window to close after
fifteen to thirty seconds.

Can anyone tell me how to do this?
Fred

Jul 20 '05 #1
3 1871
Fred Atkinson <fa*******@mishmash.com> wrote in message news:<45********************************@4ax.com>. ..
I've installed the following Javascript on my Web page and it
is working fine. It brings up a little pop up message (not an ad).

<script language="JavaScript"><!--
window1=window.open('sera.html','messageWindow1',' scrollbars=no,width=150,height=245')
//--></script>

I'd like to make the following improvements:

1. I want to control where the pop up window
appears (so it doesn't pop up over the best
part of the page). Is there any way to
specify how many pixels from the top and to
the right that the upper left corner of the
pop up window should appear?
2. I want to make the pop up window remain on top
of the main page until the pop up window is
closed.
3. I want the pop up window to close after
fifteen to thirty seconds.

Can anyone tell me how to do this?
Fred

hello,

1.
you can use :
window1=window.open('sera.html','messageWindow1',' scrollbars=no,width=150,height=245.
top=XXX, left=XXX')
and replace XXX with the offset you want

2.
to do this you need the new window to be a dialog. ( because you can
control its model/modeless )
more info here : http://www.webreference.com/js/column90/6.html
3.
you need to do make a timer that fires after 30 seconds and call
window.close()

more info:
http://www.google.com/search?hl=en&l...=Google+Search
http://www.crowes.f9.co.uk/Javascript/timer.htm

hope that was helpful

regards,
Amr Mostafa
Jul 20 '05 #2
Fred Atkinson wrote:
I've installed the following Javascript on my Web page and it
is working fine. It brings up a little pop up message (not an ad).

<script language="JavaScript"><!--
window1=window.open('sera.html','messageWindow1',' scrollbars=no,width=150,height=245')
//--></script>

I'd like to make the following improvements:

1. I want to control where the pop up window
appears (so it doesn't pop up over the best
part of the page). Is there any way to
specify how many pixels from the top and to
the right that the upper left corner of the
pop up window should appear?
The 3rd parameter of window.open() contains the attributes of the newly opened window, two
of the available attributes are top and left, of course, you must realize you will have no
idea where the browser window is on the user's screen, or where the "best part of the
page" resides, so knowing you can open the popup someplace else is pointless, because you
could open the popup at 700 x 500, and it *still* might be covering the "best part of the
page" because of where the user's browser window is positioned and where he is scrolled
to.
2. I want to make the pop up window remain on top
of the main page until the pop up window is
closed.
This can't be done reliably. Some people try to make it happen with <body
onblur="window.focus();"> but that just breaks the usability of the end-user's browser.
3. I want the pop up window to close after
fifteen to thirty seconds.
<body onload="var t = setTimeout('window.close();', 30000);">
Can anyone tell me how to do this?


All of the above assumes you'll even be able to open the window in the first place. If
it's an unrequested popup, most browsers and many add-ons for browsers that don't support
it natively now block unrequested new windows. In a browser like Opera, you will simply
*not* be able to place the popup where you want it, and in attempting to do so, may place
it somewhere inaccessible to the user.

In general, popups are a bad idea, find another way to present the content you want the
user to see.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #3
@SM


Fred Atkinson a *crit :

I've installed the following Javascript on my Web page and it
is working fine. It brings up a little pop up message (not an ad).

<script language="JavaScript"><!--
window1=window.open('sera.html','messageWindow1',' scrollbars=no,width=150,height=245')
//--></script>

I'd like to make the following improvements:

1. I want to control where the pop up window
appears (so it doesn't pop up over the best
part of the page). Is there any way to
specify how many pixels from the top and to
the right that the upper left corner of the
pop up window should appear?
top=xxx xxx = the correct value for top margin betwen internal top hedge of screen
and external top hedge of popup
left=yyy same for left margin

attributes = 'scrollbars=no,width=150,height=245,top=xxx,left=y yy';
window1=window.open('sera.html','messageWindow1',a ttributes);
2. I want to make the pop up window remain on top
of the main page until the pop up window is
closed.
<body onblur="self.focus();">
3. I want the pop up window to close after
fifteen to thirty seconds.


<body onblur="self.focus();" onload="setTimeout('self.close()',30000);">

--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
Jul 20 '05 #4

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

Similar topics

5
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to...
2
by: Juan Garcia | last post by:
Subject says it all. Given: Window A with text field. Window B with a button (onClick opens Window C) Window C with a button (onClick I want it to modify text fields of Window A) I have...
6
by: David Hayes | last post by:
juglesh <juglesh@nospamRadioKDUG.com> wrote in "Re: how to maximize the browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12 AM): > > >I want to maximize the browser...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
4
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
5
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you...
24
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.