/    Sign up×
Community /Pin to ProfileBookmark

centering a popup

I would like to center my popup on the screen. Here is my javascript code.

<SCRIPT LANGUAGE=”JavaScript”>
function openindex()
{
OpenWindow=window.open(“shippingpopup.html”,”newwin”,”height=125,width=275,toolbar=no,scrollbars=’+scroll+’,menubar=no”);
}
</script>

What do I need to add to center this popup?

Thank You,

Eli

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@elibooneauthorNov 21.2003 — Thanks for the reply Pyro. I added the following code to see if it would actually work with the way I had my script written.

<SCRIPT LANGUAGE="JavaScript">

function openindex()

{

OpenWindow=window.open("shippingpopup.html","newwin","height=125,width=275,toolbar=no,scrollbars='+scroll+',menubar=no");

}

var left = (screen.width - width)/2;

var top = (screen.height - height)/2;

var windowproperties = "width="+ width +",height="+ height +",left="+ left +",top="+top +",scrollbars=1";

</script>

My popup did move on the page, but is not quite centered. What should I change to my code?

Thank You,

Eli
Copy linkTweet thisAlerts:
@pyroNov 21.2003 — By the looks of your code, it shouldn't have made any differenece adding that code in. I'd recommend doing it as seen at the link I provided above.
Copy linkTweet thisAlerts:
@elibooneauthorNov 21.2003 — I didn't think it would move the popup either, but it did.


Your script is confusing to me. Does your popup "popup" only when someone clicks on the link or when they enter that page? I want my popup to "popup" whenver someone enters my index.html page.
Copy linkTweet thisAlerts:
@csdukDec 01.2003 — You could use this pop up generator:

http://javascript.internet.com/generators/popup-window.html

Regards.
Copy linkTweet thisAlerts:
@pyroDec 01.2003 — With the code in the link I provided, just add this to your <body>'s onload tag:

<body onload="openwin('somepage.htm','600','400');">
×

Success!

Help @eliboone spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...