SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2010
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing browser's windows' size with jquery or javascript

    For example i will create five button

    Example:

    Button1's value : 640*480
    Button2's value : 1024*600
    Button3's value : 1600*900
    Button4's value : 800*600
    If user click to button1 i want to change browser's windows' size. I want this via JQuery but maybe javascript..

    EDIT:

    And how can i change windows' position for computer's screen. Third question how can i create random number?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Most people leave their browser setting for window resizing at the default of not allowing JavaScript to change it. After all changing the window size for the page in one tab could break the layout of the pages in all the other tabs (at least in so far as the way the browser owner wants them all to look).

    Some might allow you to do it if you are actually opening a new windowand have the values specified as the width and height in the third parameter. That's assuming they don't have it overridden to open in a new tab or at their preferred size instead.

    To create a random number in JavaScript use Math.random()
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2010
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Most people leave their browser setting for window resizing at the default of not allowing JavaScript to change it. After all changing the window size for the page in one tab could break the layout of the pages in all the other tabs (at least in so far as the way the browser owner wants them all to look).

    Some might allow you to do it if you are actually opening a new windowand have the values specified as the width and height in the third parameter. That's assuming they don't have it overridden to open in a new tab or at their preferred size instead.

    To create a random number in JavaScript use Math.random()
    Thanks.. How can i move browser's window?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,683
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Derpost View Post
    Thanks.. How can i move browser's window?
    https://developer.mozilla.org/en/DOM/window.moveTo
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

Bookmarks

Posting Permissions

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