...

View Full Version : z-index for popup windows?...



canadianjameson
09-01-2004, 07:11 PM
hey.

i have a popup window that will be used to show data for every link clicked. all links will open in it. is there a way to specify something like

onLoad.window.comeToFront

basically on the second click the info loads in the popup again, but it remains behind the original page. unless people click the popup window on the bottom of the screen, they dont know it has loaded.

i want it to "pop up" again everytime new data is loaded into it

fci
09-01-2004, 07:43 PM
window_object.focus()

canadianjameson
09-02-2004, 11:15 PM
where do i put that? in the head of the HTML file being loaded into the popup?

<body window_object.focus()>

?

jamescover
09-02-2004, 11:34 PM
where do i put that? in the head of the HTML file being loaded into the popup?

yes

<body onload="javascript:window.focus();">

canadianjameson
09-02-2004, 11:56 PM
could i modify this script so that it would do that without needing it on every page?



<script type=text/javascript>
function newHotProd(urlLoc) {
_winName = "HTMLview";
_info = "toolbar=yes"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=yes"; // yes|no
_info += ",scrollbars=yes";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
DispWin=window.open(urlLoc,_winName,_info);
}
</script>


using something like "window.onLoad.window.focus()"

that would make my life a little easier. something like:



<script type=text/javascript>
function newHotProd(urlLoc) {
_winName = "HTMLview";
_info = "toolbar=yes"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=yes"; // yes|no
_info += ",scrollbars=yes";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
DispWin=window.open(urlLoc,_winName,_info,window.onLoad.window.focus());
}
</script>

Mr J
09-02-2004, 11:56 PM
Add

DispWin.focus()

to the function


<script type=text/javascript>
function newHotProd(urlLoc) {
_winName = "HTMLview";
_info = "toolbar=yes"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=yes"; // yes|no
_info += ",scrollbars=yes";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
DispWin=window.open(urlLoc,_winName,_info);
DispWin.focus()
}
</script>

canadianjameson
09-03-2004, 01:32 AM
i'll test it once i get home.

thanks mr J

also, i've never been able to get this line to work:
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise

i've tried:
_info += ",dependent=yes"; // close the parent, close the popup, omit if you want otherwise
and it didnt work.

any ideas?

glenngv
09-03-2004, 07:26 AM
That doesn't work in IE. I tested it in Firefox and it works.

Mr J
09-03-2004, 04:03 PM
I have to admit that this is the first time that I have seen this "dependant" attribute.

Please try the following

<script type=text/javascript>
<!--

DispWin=null

function newHotProd(urlLoc) {
_winName = "HTMLview";
_info = "toolbar=yes"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=yes"; // yes|no
_info += ",scrollbars=yes";// yes|no
_info += ",resizable=yes"; // yes|no
//_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
DispWin=window.open(urlLoc,_winName,_info);
DispWin.focus()
}


function closepopup(){
if(DispWin){
DispWin.close()
}
}


//Add onunload="closepopup()" to the opening BODY tag


// -->
</script>

Add onunload="closepopup()" to the opening BODY tag

canadianjameson
09-03-2004, 04:05 PM
tested and working nicely, thx mr J.

also, thx Glenn, good to know

canadianjameson
09-03-2004, 04:07 PM
actually Mr J, in retrospect the dependancy isn't that big of a deal.

I'll keep the code incase I ever do really require it to close with the parent.

Thanks again



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum