View Full Version : Javascript Pop-Up Window Help Needed

08-10-2004, 11:15 PM
There are two ways to fix this problem, but I haven't been able to figure out either. When someone goes to my site, I want a javascript popup to open on the right side and I want it to always be on top. I've figured everything out and gotten it to work with the following code, but I can't figure out how to implement the always on top javascript code (<BODY onBlur="window.focus();"> ) into the pop-up window.

Here is the code I'm using, placed in the body of the main page:

<script language=JavaScript>
var win=window.open('a.html' ,'_BLANK'," toolbar=no,location=no,status=no,menubar=no,scroll
win.resizeTo(X, Y);
win.moveTo(X, Y);
win.document.write("<html><Head><Title>TITLE</Title></Head><body topmargin=0 leftmargin=0><img src='http://site.jpg' width=X height=Y alt='' border=0></body></html>");

So I either need to know how to work the onBlur code snippet into the aforementioned code, or how to make the window the code creates load another page with the onBlur code, although the former would be better.

Also, what code could be inserted to make the pop-up automatically close when the user goes to a different page from the one generating the pop-up?


08-11-2004, 12:06 AM
<script language="JavaScript">

place this just below the <body> tag and it should do the trick

as for the closing when the user navigates away, try this:

<script language="JavaScript">

08-11-2004, 12:14 AM
i use this:

<script type=text/javascript>
function newWin(urlLoc) {
_winName = "popupSelect";
_info = "toolbar=no"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=no"; // yes|no
_info += ",scrollbars=no";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
_info += ",height=250";
_info += ",width=425";
_info += ",left=150";
_info += ",top=100";

and then

<body ... >
<a href="javascript:newWin('blahblah.htm')">

modify the above to a window.open

08-11-2004, 12:27 AM
Is there a way to make it load an image instead of a url?

08-11-2004, 01:19 AM
I'm not sure what dictates the "always on top" out of what you posted..

08-11-2004, 04:38 PM
to my knowledge (in the first script), not specifying a position defaults it to top=0px, left=0px. but thats just an educated guess

as for the image. in short, no. that would be asking the image to simply float in space.

the web page is just a container, if you will, for all the objects to be placed in. you need a url.

however you can give the semblance of a single image floating using <div>'s.
do a forum search on "floating div" and you should find a prewritten script or two to do exactly what you want.

08-27-2004, 10:45 PM
Im in no way a coder.. but ive been trying to get help with this problem for a few months..and i havent found any help..

Im just simply trying to get my Geocities.com page to load once my .Tk site is accessed.

Like a Full screen Javascript pop up.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=600');");
// End -->

<title>Enter ME!!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body bgcolor="#000000">

<BODY onLoad="javascript:popUp('http://www.geocities.com/supaskrilla/main.html')">

Any guesses why its not working?

08-28-2004, 01:27 AM
"quote...Any guesses why its not working?...endquote"

ummm...just a guessingŪ...but you have/had TWO body tags...:O(

<body bgcolor="#000000">

<BODY onLoad="javascript:popUp('http://www.geocities.com/supaskrilla/main.html')">

n' just a psŪ...
hugs n' welcome to the forum...:O)))

08-28-2004, 05:46 AM
Worked! thanks :)