Loading ...
Sorry, an error occurred while loading the content.

Page resize

Expand Messages
  • dmauray
    Does anyone know how to get the size of the used space in a window. I am opening a new window and I don t know how many lines will be on it until it is
    Message 1 of 13 , May 5, 2003
    • 0 Attachment
      Does anyone know how to get the size of the used space in a window.
      I am opening a new window and I don't know how many lines will be on
      it until it is displayed. The problem is to reduce the amount of
      white space at the bottom and have it big enough to display the
      entire page (may be 4 lines 1 time and 20 the next). Changing the
      size is easy when you know the size but how do you get the size in
      JavaScript?

      Thanx
      Dale
    • Chris Adams
      Dale, In Netscape, you can use the window.innerHeight function of Javascript. Unfortunately, that doesn t work in IE. So, for IE, you can use the old
      Message 2 of 13 , May 6, 2003
      • 0 Attachment
        Dale,

        In Netscape, you can use the window.innerHeight function of Javascript.
        Unfortunately, that doesn't work in IE. So, for IE, you can use the old
        'invisible image' trtick to find the available size of the window. At the
        top of your <body> section, put a fake image:

        <img id="docheight" height="100%" border="0" width="0" style="position:
        absolute; top: 0px; visibility: hidden" />

        Then use Javascript to read the height of that image with the
        document.all.docheight.height function. "docheight" is simply the name I
        gave the image tag; you can name it whatever you want.

        Chris

        At 03:26 PM 5/5/2003, you wrote:
        >Does anyone know how to get the size of the used space in a window.
        >I am opening a new window and I don't know how many lines will be on
        >it until it is displayed. The problem is to reduce the amount of
        >white space at the bottom and have it big enough to display the
        >entire page (may be 4 lines 1 time and 20 the next). Changing the
        >size is easy when you know the size but how do you get the size in
        >JavaScript?
      • ICO.SYSTEM//
        How does that image help with the page resize ? ~gerri~ ================ COWBOY BEBOP BLUES: http://members.bellatlantic.net/~vze26khi ...
        Message 3 of 13 , May 6, 2003
        • 0 Attachment
          How does that 'image' help with the page resize ?

          ~gerri~

          ================
          COWBOY BEBOP BLUES:
          http://members.bellatlantic.net/~vze26khi
          ================


          --- message from Chris Adams <chris@...> attached:

          _____________________________________________________________
          BootBox.Net - Your Home on the Internet
          http://www.bootbox.net

          Get an @... webmail account - http://webmail.bootbox.net

          Get Dialup Internet Access for only $8.95/mo
          http://isp.bootbox.net

          Host Your Website For Free- http://webhosting.bootbox.net

          Put Your E-Commerce Business Online Virtually Free - http://bcommerce.bootbox.net

          _____________________________________________________________
          Select your own custom email address for FREE! Get you@... w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag


          [Non-text portions of this message have been removed]
        • dmauray
          I was thinking something with images also but the problem is that this image will fill the entire window. I need the size of the used portion of the window.
          Message 4 of 13 , May 6, 2003
          • 0 Attachment
            I was thinking something with images also but the problem is that
            this image will fill the entire window. I need the size of the used
            portion of the window. I need to know if I need to shrink the window
            size.

            BTW window.screen.availHeight will give you the inside height of a
            window in IE.

            Dale


            --- In javascript_official@yahoogroups.com, Chris Adams <chris@c...>
            wrote:
            > Dale,
            >
            > In Netscape, you can use the window.innerHeight function of
            Javascript.
            > Unfortunately, that doesn't work in IE. So, for IE, you can use the
            old
            > 'invisible image' trtick to find the available size of the window.
            At the
            > top of your <body> section, put a fake image:
            >
            > <img id="docheight" height="100%" border="0" width="0"
            style="position:
            > absolute; top: 0px; visibility: hidden" />
            >
            > Then use Javascript to read the height of that image with the
            > document.all.docheight.height function. "docheight" is simply the
            name I
            > gave the image tag; you can name it whatever you want.
            >
            > Chris
            >
            > At 03:26 PM 5/5/2003, you wrote:
            > >Does anyone know how to get the size of the used space in a window.
            > >I am opening a new window and I don't know how many lines will be
            on
            > >it until it is displayed. The problem is to reduce the amount of
            > >white space at the bottom and have it big enough to display the
            > >entire page (may be 4 lines 1 time and 20 the next). Changing the
            > >size is easy when you know the size but how do you get the size in
            > >JavaScript?
          • Chris Adams
            Well, it doesn t help if someone resizes a window after the page has loaded. However, if someone tends not to run their browser at full screen, the image is an
            Message 5 of 13 , May 6, 2003
            • 0 Attachment
              Well, it doesn't help if someone resizes a window after the page has
              loaded. However, if someone tends not to run their browser at full screen,
              the image is an easy way to find out what the pixel height of their window
              is for IE. The image prints at 100% of the available window, and then the
              docheight function reads what the exact pixel height is.

              Now that I re-read Dale's post, it seems that maybe he's looking to resize
              the window based on how much text is printed so there's no whitespace or
              scrolling. So let me change my tune a little. For that, I would use CSS
              within a DIV in combination with the document.all.docheight.height function:

              <div style="position: absolute; top: 0px; left: 0px; width: 100%; height:
              10px">
              TEXT GOES HERE
              <img id="docheight" height="100%" border="0" width="0" style="position:
              absolute; top: 0px; visibility: hidden" />
              </div>

              Now instead of the image being the size of the entire window, it will only
              be the size of the <div> box. The "height: 10px" setting is only there to
              define an initial height; unless the font-size of the text is 8px and
              there's only one line of text, then the <div> box will push out to the
              actual height of the full amount of text, and document.all.docheight.height
              will give an accurate reading of the pixel height of that <div> box.

              Chris

              At 08:31 AM 5/6/2003, you wrote:
              >How does that 'image' help with the page resize ?
              >
              >~gerri~
            • Chris Adams
              Did you get my other post? After Gerri asked the question, it made me rethink what you were looking for, and I believe you can get what you need by putting the
              Message 6 of 13 , May 6, 2003
              • 0 Attachment
                Did you get my other post? After Gerri asked the question, it made me
                rethink what you were looking for, and I believe you can get what you need
                by putting the image within a <div> tag.

                I don't know about the window.screen.availHeight function. My screen
                resolution is 1024x768, and every time I use that, it always returns 768,
                regardless of the size of the browser screen.

                Chris

                At 09:11 AM 5/6/2003, you wrote:
                >I was thinking something with images also but the problem is that
                >this image will fill the entire window. I need the size of the used
                >portion of the window. I need to know if I need to shrink the window
                >size.
                >
                >BTW window.screen.availHeight will give you the inside height of a
                >window in IE.
              • visagan_k
                Send Ur hetml file I will adjust and give it to U which will work for any resolution ... me ... you need ... screen ... returns 768, ... used ... window
                Message 7 of 13 , May 7, 2003
                • 0 Attachment
                  Send Ur hetml file I will adjust and give it to U which will work for
                  any resolution


                  --- In javascript_official@yahoogroups.com, Chris Adams <chris@c...>
                  wrote:
                  > Did you get my other post? After Gerri asked the question, it made
                  me
                  > rethink what you were looking for, and I believe you can get what
                  you need
                  > by putting the image within a <div> tag.
                  >
                  > I don't know about the window.screen.availHeight function. My
                  screen
                  > resolution is 1024x768, and every time I use that, it always
                  returns 768,
                  > regardless of the size of the browser screen.
                  >
                  > Chris
                  >
                  > At 09:11 AM 5/6/2003, you wrote:
                  > >I was thinking something with images also but the problem is that
                  > >this image will fill the entire window. I need the size of the
                  used
                  > >portion of the window. I need to know if I need to shrink the
                  window
                  > >size.
                  > >
                  > >BTW window.screen.availHeight will give you the inside height of a
                  > >window in IE.
                • dmauray
                  You are correct about the availHeight, I grabed the wrong line of code. What I use to the the inside dimensions of the screen are: originalWidth =
                  Message 8 of 13 , May 7, 2003
                  • 0 Attachment
                    You are correct about the availHeight, I grabed the wrong line of
                    code. What I use to the the inside dimensions of the screen are:
                    originalWidth = document.body.clientWidth;
                    originalHeight = document.body.clientHeight;
                    The reason I use this code is to return the window to its original
                    size after the user closes my application (these are stored in
                    cookies).

                    Dale


                    --- In javascript_official@yahoogroups.com, Chris Adams <chris@c...>
                    wrote:
                    > Did you get my other post? After Gerri asked the question, it made
                    me
                    > rethink what you were looking for, and I believe you can get what
                    you need
                    > by putting the image within a <div> tag.
                    >
                    > I don't know about the window.screen.availHeight function. My
                    screen
                    > resolution is 1024x768, and every time I use that, it always
                    returns 768,
                    > regardless of the size of the browser screen.
                    >
                    > Chris
                    >
                    > At 09:11 AM 5/6/2003, you wrote:
                    > >I was thinking something with images also but the problem is that
                    > >this image will fill the entire window. I need the size of the
                    used
                    > >portion of the window. I need to know if I need to shrink the
                    window
                    > >size.
                    > >
                    > >BTW window.screen.availHeight will give you the inside height of a
                    > >window in IE.
                  • Kenneth Bull
                    Enclose your text, etc. in one big DIV tag, then use clientHeight to find the height of the DIV. Use an empty paragraph tag to take up the extra space. (This
                    Message 9 of 13 , May 7, 2003
                    • 0 Attachment
                      Enclose your text, etc. in one big DIV tag, then use clientHeight to find the height of the DIV.
                      Use an empty paragraph tag to take up the extra space.
                      (This method does not account for margins)

                      <BODY leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0>
                      <DIV id=divHeight>
                      .
                      :
                      </div>
                      <P>
                      </body>

                      <SCRIPT>
                      window.resizeTo(divHeight.clientWidth, divHeight.clientHeight);
                      </script>

                      ------------------------------------------------------------------

                      Date: Tue, 06 May 2003 13:11:35 -0000
                      From: "dmauray" <dale@...>
                      Subject: Re: Page resize

                      I was thinking something with images also but the problem is that
                      this image will fill the entire window. I need the size of the used
                      portion of the window. I need to know if I need to shrink the window
                      size.

                      BTW window.screen.availHeight will give you the inside height of a
                      window in IE.

                      Dale


                      --- In javascript_official@yahoogroups.com, Chris Adams <chris@c...>
                      wrote:
                      > Dale,
                      >
                      > In Netscape, you can use the window.innerHeight function of
                      Javascript.
                      > Unfortunately, that doesn't work in IE. So, for IE, you can use the
                      old
                      > 'invisible image' trtick to find the available size of the window.
                      At the
                      > top of your <body> section, put a fake image:
                      >
                      > <img id="docheight" height="100%" border="0" width="0"
                      style="position:
                      > absolute; top: 0px; visibility: hidden" />
                      >
                      > Then use Javascript to read the height of that image with the
                      > document.all.docheight.height function. "docheight" is simply the
                      name I
                      > gave the image tag; you can name it whatever you want.
                      >
                      > Chris
                      >
                      > At 03:26 PM 5/5/2003, you wrote:
                      > >Does anyone know how to get the size of the used space in a window.
                      > >I am opening a new window and I don't know how many lines will be
                      on
                      > >it until it is displayed. The problem is to reduce the amount of
                      > >white space at the bottom and have it big enough to display the
                      > >entire page (may be 4 lines 1 time and 20 the next). Changing the
                      > >size is easy when you know the size but how do you get the size in
                      > >JavaScript?




                      ______________________________________________________________________
                      Post your free ad now! http://personals.yahoo.ca
                    • Kenneth Bull
                      Try this: function resize() { window.resizeTo(preContent.offsetWidth+48, preContent.offsetHeight+144); }
                      Message 10 of 13 , May 28, 2003
                      • 0 Attachment
                        Try this:

                        <SCRIPT>
                        function resize() {
                        window.resizeTo(preContent.offsetWidth+48, preContent.offsetHeight+144);
                        }
                        </script>
                        <BODY onload="resize();">
                        <SPAN id="preContent">
                        blah, blah, blah, blah, blah, <BR>
                        lah, blah, blah, blah, blah, b<BR>
                        ah, blah, blah, blah, blah, bl<BR>
                        h, blah, blah, blah, blah, bla<BR>
                        , blah, blah, blah, blah, blah<BR>
                        blah, blah, blah, blah, blah,<BR>
                        blah, blah, blah, blah, blah, <BR>
                        lah, blah, blah, blah, blah, b<BR>
                        ah, blah, blah, blah, blah, bl<BR>
                        h, blah, blah, blah, blah, bla<BR>
                        , blah, blah, blah, blah, blah<BR>
                        </span>
                        </body>

                        You can use <NOBR></nobr> to prevent text wrapping.

                        ------------------------------------------------------------------------------
                        Date: Tue, 27 May 2003 23:25:07 +0200
                        From: "Andrew Newton" <anewton@...>
                        Subject: Re: Re: Page resize

                        Hi Ken

                        Hope you don't mind going back to an old post.

                        I have been trying to resize a window using your code.

                        Explorer opens each time a small window of 100 x 100 irrespective of the
                        contents of the <div></div>.

                        Do you have any idea why?

                        Thanks in advance

                        Andrew


                        ----- Original Message -----
                        From: "Kenneth Bull" <kenneth_bull@...>
                        To: <javascript_official@yahoogroups.com>
                        Sent: Wednesday, May 07, 2003 3:34 PM
                        Subject: [JavaScript] Re: Page resize


                        > Enclose your text, etc. in one big DIV tag, then use clientHeight to find
                        the height of the DIV.
                        > Use an empty paragraph tag to take up the extra space.
                        > (This method does not account for margins)
                        >
                        > <BODY leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0>
                        > <DIV id=divHeight>
                        > .
                        > :
                        > </div>
                        > <P>
                        > </body>
                        >
                        > <SCRIPT>
                        > window.resizeTo(divHeight.clientWidth, divHeight.clientHeight);
                        > </script>
                        >
                        > ------------------------------------------------------------------
                        >
                        > Date: Tue, 06 May 2003 13:11:35 -0000
                        > From: "dmauray" <dale@...>
                        > Subject: Re: Page resize
                        >
                        > I was thinking something with images also but the problem is that
                        > this image will fill the entire window. I need the size of the used
                        > portion of the window. I need to know if I need to shrink the window
                        > size.
                        >
                        > BTW window.screen.availHeight will give you the inside height of a
                        > window in IE.
                        >
                        > Dale
                        >
                        >
                        > --- In javascript_official@yahoogroups.com, Chris Adams <chris@c...>
                        > wrote:
                        > > Dale,
                        > >
                        > > In Netscape, you can use the window.innerHeight function of
                        > Javascript.
                        > > Unfortunately, that doesn't work in IE. So, for IE, you can use the
                        > old
                        > > 'invisible image' trtick to find the available size of the window.
                        > At the
                        > > top of your <body> section, put a fake image:
                        > >
                        > > <img id="docheight" height="100%" border="0" width="0"
                        > style="position:
                        > > absolute; top: 0px; visibility: hidden" />
                        > >
                        > > Then use Javascript to read the height of that image with the
                        > > document.all.docheight.height function. "docheight" is simply the
                        > name I
                        > > gave the image tag; you can name it whatever you want.
                        > >
                        > > Chris
                        > >
                        > > At 03:26 PM 5/5/2003, you wrote:
                        > > >Does anyone know how to get the size of the used space in a window.
                        > > >I am opening a new window and I don't know how many lines will be
                        > on
                        > > >it until it is displayed. The problem is to reduce the amount of
                        > > >white space at the bottom and have it big enough to display the
                        > > >entire page (may be 4 lines 1 time and 20 the next). Changing the
                        > > >size is easy when you know the size but how do you get the size in
                        > > >JavaScript?
                        >
                        >
                        >
                        >
                        > ______________________________________________________________________
                        > Post your free ad now! http://personals.yahoo.ca
                        >
                        >
                        > To unsubscribe from this group, send an email to:
                        > javascript_official-unsubscribe@yahoogroups.com
                        >
                        >
                        >
                        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                        >
                        >
                        >






                        ---------------------------------
                        Post your free ad now! Yahoo! Canada Personals


                        [Non-text portions of this message have been removed]
                      • dmauray
                        When I asked this question, the responses were good. I don t like the Div tag, so I use a Span tag, simple enough. Also, the resizeBy function is better
                        Message 11 of 13 , May 28, 2003
                        • 0 Attachment
                          When I asked this question, the responses were good. I don't like
                          the Div tag, so I use a Span tag, simple enough. Also, the resizeBy
                          function is better suited to what I was trying to do.

                          <span id="docheight" style="width: 100%; ">
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          </span><script language="JavaScript">if(docheight.clientHeight > 525)
                          { newHeight = 525 - document.body.clientHeight; } else { newHeight =
                          docheight.clientHeight - document.body.clientHeight; }
                          top.window.resizeBy(0, newHeight);</script>

                          What I did was to put all the script on the line with the /Span tag
                          so it will run as soon as it is processed. I wanted it in as few
                          lines as possible. Anyway, this will resize the page to a max height
                          of 525 inside.

                          Dale


                          --- In javascript_official@yahoogroups.com, Kenneth Bull
                          <kenneth_bull@y...> wrote:
                          > Try this:
                          >
                          > <SCRIPT>
                          > function resize() {
                          > window.resizeTo(preContent.offsetWidth+48,
                          preContent.offsetHeight+144);
                          > }
                          > </script>
                          > <BODY onload="resize();">
                          > <SPAN id="preContent">
                          > blah, blah, blah, blah, blah, <BR>
                          > lah, blah, blah, blah, blah, b<BR>
                          > ah, blah, blah, blah, blah, bl<BR>
                          > h, blah, blah, blah, blah, bla<BR>
                          > , blah, blah, blah, blah, blah<BR>
                          > blah, blah, blah, blah, blah,<BR>
                          > blah, blah, blah, blah, blah, <BR>
                          > lah, blah, blah, blah, blah, b<BR>
                          > ah, blah, blah, blah, blah, bl<BR>
                          > h, blah, blah, blah, blah, bla<BR>
                          > , blah, blah, blah, blah, blah<BR>
                          > </span>
                          > </body>
                          >
                          > You can use <NOBR></nobr> to prevent text wrapping.
                          >
                          > --------------------------------------------------------------------
                          ----------
                          > Date: Tue, 27 May 2003 23:25:07 +0200
                          > From: "Andrew Newton" <anewton@c...>
                          > Subject: Re: Re: Page resize
                          >
                          > Hi Ken
                          >
                          > Hope you don't mind going back to an old post.
                          >
                          > I have been trying to resize a window using your code.
                          >
                          > Explorer opens each time a small window of 100 x 100 irrespective
                          of the
                          > contents of the <div></div>.
                          >
                          > Do you have any idea why?
                          >
                          > Thanks in advance
                          >
                          > Andrew
                          >
                          >
                          > ----- Original Message -----
                          > From: "Kenneth Bull" <kenneth_bull@y...>
                          > To: <javascript_official@yahoogroups.com>
                          > Sent: Wednesday, May 07, 2003 3:34 PM
                          > Subject: [JavaScript] Re: Page resize
                          >
                          >
                          > > Enclose your text, etc. in one big DIV tag, then use clientHeight
                          to find
                          > the height of the DIV.
                          > > Use an empty paragraph tag to take up the extra space.
                          > > (This method does not account for margins)
                          > >
                          > > <BODY leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0>
                          > > <DIV id=divHeight>
                          > > .
                          > > :
                          > > </div>
                          > > <P>
                          > > </body>
                          > >
                          > > <SCRIPT>
                          > > window.resizeTo(divHeight.clientWidth, divHeight.clientHeight);
                          > > </script>
                          > >
                          > > ------------------------------------------------------------------
                          > >
                          > > Date: Tue, 06 May 2003 13:11:35 -0000
                          > > From: "dmauray" <dale@i...>
                          > > Subject: Re: Page resize
                          > >
                          > > I was thinking something with images also but the problem is that
                          > > this image will fill the entire window. I need the size of the
                          used
                          > > portion of the window. I need to know if I need to shrink the
                          window
                          > > size.
                          > >
                          > > BTW window.screen.availHeight will give you the inside height of a
                          > > window in IE.
                          > >
                          > > Dale
                          > >
                          > >
                          > > --- In javascript_official@yahoogroups.com, Chris Adams
                          <chris@c...>
                          > > wrote:
                          > > > Dale,
                          > > >
                          > > > In Netscape, you can use the window.innerHeight function of
                          > > Javascript.
                          > > > Unfortunately, that doesn't work in IE. So, for IE, you can use
                          the
                          > > old
                          > > > 'invisible image' trtick to find the available size of the
                          window.
                          > > At the
                          > > > top of your <body> section, put a fake image:
                          > > >
                          > > > <img id="docheight" height="100%" border="0" width="0"
                          > > style="position:
                          > > > absolute; top: 0px; visibility: hidden" />
                          > > >
                          > > > Then use Javascript to read the height of that image with the
                          > > > document.all.docheight.height function. "docheight" is simply
                          the
                          > > name I
                          > > > gave the image tag; you can name it whatever you want.
                          > > >
                          > > > Chris
                          > > >
                          > > > At 03:26 PM 5/5/2003, you wrote:
                          > > > >Does anyone know how to get the size of the used space in a
                          window.
                          > > > >I am opening a new window and I don't know how many lines will
                          be
                          > > on
                          > > > >it until it is displayed. The problem is to reduce the amount
                          of
                          > > > >white space at the bottom and have it big enough to display the
                          > > > >entire page (may be 4 lines 1 time and 20 the next). Changing
                          the
                          > > > >size is easy when you know the size but how do you get the
                          size in
                          > > > >JavaScript?
                          > >
                          > >
                          > >
                          > >
                          > >
                          ______________________________________________________________________
                          > > Post your free ad now! http://personals.yahoo.ca
                          > >
                          > >
                          > > To unsubscribe from this group, send an email to:
                          > > javascript_official-unsubscribe@yahoogroups.com
                          > >
                          > >
                          > >
                          > > Your use of Yahoo! Groups is subject to
                          http://docs.yahoo.com/info/terms/
                          > >
                          > >
                          > >
                          >
                          >
                          >
                          >
                          >
                          >
                          > ---------------------------------
                          > Post your free ad now! Yahoo! Canada Personals
                          >
                          >
                          > [Non-text portions of this message have been removed]
                        • email2davinder
                          I have a HTML page made in 1024 * 768 pixels, I want to change users any screen resolution to 1024*768. I am using Jscript window.onload = check_width function
                          Message 12 of 13 , Oct 31, 2003
                          • 0 Attachment
                            I have a HTML page made in 1024 * 768 pixels, I want to change users
                            any screen resolution to 1024*768.

                            I am using Jscript


                            window.onload = check_width

                            function check_width() {
                            var correctwidth=1024;
                            // You can personalize "correctwidth" according to your layout.

                            if (screen.width!=correctwidth) {

                            document.body.style.zoom = screen.width / correctwidth;

                            }
                            }

                            but problem is that when i change the resolution font gets disturbed.

                            Is there otger way to do that
                            please help
                          • James Eberhardt
                            I would recommend NOT changing the users screen resolution. This can be disorienting and annoying to users. This is considered a very intrusive way of
                            Message 13 of 13 , Oct 31, 2003
                            • 0 Attachment
                              I would recommend NOT changing the users' screen resolution. This can
                              be disorienting and annoying to users. This is considered a very
                              intrusive way of displaying your site. Please reconsider the solution
                              to this. Also, if the users' screen is only set to 800x600, then there
                              is no way to resize it larger, and you'll have another problem when you
                              try to do it.

                              James

                              >> -----Original Message-----
                              >> From: email2davinder [mailto:no_reply@yahoogroups.com]
                              >> Sent: Friday, October 31, 2003 3:04 AM
                              >> To: javascript_official@yahoogroups.com
                              >> Subject: [JavaScript] Page resize_ please help
                              >>
                              >>
                              >> I have a HTML page made in 1024 * 768 pixels, I want to
                              >> change users
                              >> any screen resolution to 1024*768.
                            Your message has been successfully submitted and would be delivered to recipients shortly.