/    Sign up×
Community /Pin to ProfileBookmark

Centering a popup window

I have the ff as part of my javascript and I want the popup window to center in the client’s window. Please help. I highlighted the part where I need help.

if (counter == 0)
{
var myRes = “<html><head>n”;
myRes += “<title>Popup Window</title>n”;
myRes += “</head><body>n”;
myRes += “<div style=’text-align:center’>n”;
myRes += “<p>Search character ‘<b>” + searchChar + “</b>’ not found in text string!</p>n”;
myRes += “<input type=’button’ value=’Close Window’ onclick=’window.close()’>n”;
myRes += “</div>n”;
myRes += “</body>n</html>”;

[COLOR=”DarkRed”]var popup = window.open(“”, “Popup”, “top=10,left=300,width=300,height=100”);[/COLOR]
popup.focus();
popup.document.write(myRes);
popup.document.close();

to post a comment
JavaScript

1 Comments(s)

×

Success!

Help @b72358 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 4.28,
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,
)...