Jump to content

Pop-Up Windows Reused


TRI0N

Recommended Posts

I'm currently using this code to open up a window and what to know how I can make it so that if I click a link that it uses that window again rather then open up a new one.

 

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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=520,height=400');");
}
// End -->
</script>

 

Thanks for any help on this.

Link to comment
https://forums.phpfreaks.com/topic/42290-pop-up-windows-reused/
Share on other sites

Okay that was easy..  Pfft..  God can't even believe I didn't even see the dumb id code being built for it.  It would never be the same ID..

 

Anyways on to a more problematic need for a fix.

 

Now lets say the window is open and I click another link that uses that window to Focus on it since it is either minimized or not in view.

 

Current Code:

<!-- Begin
function popUp(URL) {
window.open(URL,"Window1", 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=520,height=400');
}
// End -->

 

Update:

 

A simple:

<body onload="self.focus();">

 

For the pages that are to load in the window does the trick.

Link to comment
https://forums.phpfreaks.com/topic/42290-pop-up-windows-reused/#findComment-205165
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.