/    Sign up×
Community /Pin to ProfileBookmark

window position

ok, first off i’m a bit of a javascript noob so please excuse my semi-pseudo code. i’m working on an cropping tool so i have a small (500×250) popup that initially loads, when i click a button I’m response.redirecting back to the same window (long story but it has to work like this) and the window needs to now change to 800×700 but ideally i’d like it centered on the screen. the code below is an excerpt from my popup that is fired when i reload my page (based on a certain condition). The parent.resizeTo works ok but the parent.left, parent.top bit isn’t. Anyone got any ideas as i’m sorta making this up as i go along. The ltClose bit is an asp.net control i’m writing to to trigger this.

ltClose.Text += “<script type=””text/javascript””>” & vbCrLf
ltClose.Text += “parent.resizeTo(800,700);” & vbCrLf
ltClose.Text += “var width = 800;” & vbCrLf
ltClose.Text += “var height = 700;” & vbCrLf
ltClose.Text += “var left = parseInt((screen.availWidth / 2) – (width / 2));” & vbCrLf
ltClose.Text += “var top = parseInt((screen.availHeight / 2) – (height / 2));” & vbCrLf
ltClose.Text += “parent.left=left ;” & vbCrLf
ltClose.Text += “parent.top= top ;” & vbCrLf
ltClose.Text += “parent.screenX= left ;” & vbCrLf
ltClose.Text += “parent.screenY= top;” & vbCrLf
ltClose.Text += “</script>”

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 26.2010 — self.moveTo(left, top);
×

Success!

Help @neilakoga 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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