Results 1 to 2 of 2

Thread: window position

  1. #1
    Join Date
    Mar 2010

    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 (500x250) 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 800x700 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>"

  2. #2
    Join Date
    Apr 2003
    self.moveTo(left, top);
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center