Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. setting document size

setting document size

Scheduled Pinned Locked Moved Web Development
javascriptcsstoolsquestion
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Force Code
    wrote on last edited by
    #1

    I've been doing Flex and AS3 programming for about five months, but now I'm having to delve into Javascript with which I have no experience. I have what I think is a very basic Javascript question. My basic terminology may not even be accurate, but I think I want to resize the 'document' as opposed to the window. For at least some browsers, I think you can say window.Resize(x,y) and it will resize the actual browser window. However, I want to resize not the window, but rather the scrollable area of the page, regardless of what text or other content the page actually contains. So if all the page contains is "Hello World", I want to be able to resize the scrollable area to some arbitrary size, so that maybe it could be scrolled down for several pages. Contrarily, I want to be able to set the width of the page to less (or greater) than the width of the browser window width, so that presumably there could be a blank area between the right edge of the page and the right edge of the browser window. I also want to be able to set the scroll position of the page, And also if possible the option to show or hide the scroll bars, regardless of the document size. I spent three hours last night trying to find this information without success. I was trying to do the above on the onLoad event in the body tag (calling a javascript function defined in a previous script section.)

    L S L 3 Replies Last reply
    0
    • F Force Code

      I've been doing Flex and AS3 programming for about five months, but now I'm having to delve into Javascript with which I have no experience. I have what I think is a very basic Javascript question. My basic terminology may not even be accurate, but I think I want to resize the 'document' as opposed to the window. For at least some browsers, I think you can say window.Resize(x,y) and it will resize the actual browser window. However, I want to resize not the window, but rather the scrollable area of the page, regardless of what text or other content the page actually contains. So if all the page contains is "Hello World", I want to be able to resize the scrollable area to some arbitrary size, so that maybe it could be scrolled down for several pages. Contrarily, I want to be able to set the width of the page to less (or greater) than the width of the browser window width, so that presumably there could be a blank area between the right edge of the page and the right edge of the browser window. I also want to be able to set the scroll position of the page, And also if possible the option to show or hide the scroll bars, regardless of the document size. I spent three hours last night trying to find this information without success. I was trying to do the above on the onLoad event in the body tag (calling a javascript function defined in a previous script section.)

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      That doesn't make sense. The scrollable area is defined by the markup in the page, you can't set it because that would be inconsistent to what a browser is supposed to do, render the markup.

      led mike

      F 1 Reply Last reply
      0
      • L led mike

        That doesn't make sense. The scrollable area is defined by the markup in the page, you can't set it because that would be inconsistent to what a browser is supposed to do, render the markup.

        led mike

        F Offline
        F Offline
        Force Code
        wrote on last edited by
        #3

        led mike wrote:

        That doesn't make sense. The scrollable area is defined by the markup in the page, you can't set it because that would be inconsistent to what a browser is supposed to do, render the markup.

        Here's one area it makes sense. I found out that flash (or whatever the correct collective term is for flash, flex actionscript shockwave etc) has very limited built in capabilities for displaying html - there is no built in browser control for displaying a web page in a flash document. So, what they do is a hack, accessing an iframe defined in the html wrapper, via a javascript function also defined in the html wrapper, and displaying that iframe on top of the flash program. However, if the flash program has its own scroll bar, the html wrapper doesn't know anything about it and the iframe will be displayed on top of it. So, I was wanting some method to resize the html "page" (or 'document') via a javascript call from flash, reducing the page width so the iframe wouldn't display on top of the flash scroll bar. It occured to me though, that as far as the page height, just setting the correct y location of the iframe would automatically extend the height of the html wrapper to correspond to the height of the flash page. I still need to be able to set the scroll position of the wrapper, so that if I have several iframes, I don't have to reposition each one individually.

        L 1 Reply Last reply
        0
        • F Force Code

          led mike wrote:

          That doesn't make sense. The scrollable area is defined by the markup in the page, you can't set it because that would be inconsistent to what a browser is supposed to do, render the markup.

          Here's one area it makes sense. I found out that flash (or whatever the correct collective term is for flash, flex actionscript shockwave etc) has very limited built in capabilities for displaying html - there is no built in browser control for displaying a web page in a flash document. So, what they do is a hack, accessing an iframe defined in the html wrapper, via a javascript function also defined in the html wrapper, and displaying that iframe on top of the flash program. However, if the flash program has its own scroll bar, the html wrapper doesn't know anything about it and the iframe will be displayed on top of it. So, I was wanting some method to resize the html "page" (or 'document') via a javascript call from flash, reducing the page width so the iframe wouldn't display on top of the flash scroll bar. It occured to me though, that as far as the page height, just setting the correct y location of the iframe would automatically extend the height of the html wrapper to correspond to the height of the flash page. I still need to be able to set the scroll position of the wrapper, so that if I have several iframes, I don't have to reposition each one individually.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          Wow what a pile of garbage, and you are doing all this for what purpose? I mean why is it important or what feature or whatever is it intended to provide?

          led mike

          F 2 Replies Last reply
          0
          • L led mike

            Wow what a pile of garbage, and you are doing all this for what purpose? I mean why is it important or what feature or whatever is it intended to provide?

            led mike

            F Offline
            F Offline
            Force Code
            wrote on last edited by
            #5

            led mike wrote:

            Wow what a pile of garbage, and you are doing all this for what purpose? I mean why is it important or what feature or whatever is it intended to provide?

            Ummmm... I want to have iframe capability in a flash program like iframes exist on an html page. I think the utility of being able to display some web page within another web page (or in a flash program) should be self evident. There are implementations of iframes I've seen for flex and actionscript that utilize the mechanisms I described, but the ones I've seen thus far seem to be lacking some functionality I'm looking for. As far as the "garbage" comment, I don't really understand either, what technical hurdles could possibly exist that would cause Adobe to exclude this extremely important functionality from their platforms. However, their capabilities in many areas are dazzling, and that is why Microsoft created Silverlight, to try to compete with them.

            1 Reply Last reply
            0
            • F Force Code

              I've been doing Flex and AS3 programming for about five months, but now I'm having to delve into Javascript with which I have no experience. I have what I think is a very basic Javascript question. My basic terminology may not even be accurate, but I think I want to resize the 'document' as opposed to the window. For at least some browsers, I think you can say window.Resize(x,y) and it will resize the actual browser window. However, I want to resize not the window, but rather the scrollable area of the page, regardless of what text or other content the page actually contains. So if all the page contains is "Hello World", I want to be able to resize the scrollable area to some arbitrary size, so that maybe it could be scrolled down for several pages. Contrarily, I want to be able to set the width of the page to less (or greater) than the width of the browser window width, so that presumably there could be a blank area between the right edge of the page and the right edge of the browser window. I also want to be able to set the scroll position of the page, And also if possible the option to show or hide the scroll bars, regardless of the document size. I spent three hours last night trying to find this information without success. I was trying to do the above on the onLoad event in the body tag (calling a javascript function defined in a previous script section.)

              S Offline
              S Offline
              Shog9 0
              wrote on last edited by
              #6

              Just think of HTML as a bunch of nested boxes created from elements in the HTML. <html> is your document, <body> holds the stuff inside it; the box created for the former is the size of the window (client area) and the box created for the latter is the size needed to display whatever it contains. So if you force the size of <body> to be larger than <html>, you'll scroll (unless you disable scrolling...) Of course, on older browsers things are a bit more weird, but... i find it's best to just ignore them.

              Citizen 20.1.01

              'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

              1 Reply Last reply
              0
              • L led mike

                Wow what a pile of garbage, and you are doing all this for what purpose? I mean why is it important or what feature or whatever is it intended to provide?

                led mike

                F Offline
                F Offline
                Force Code
                wrote on last edited by
                #7

                Just to be clear, you can load another flash page into any other flash page without any problem, using something called SWFLoader. There's also something called URLLoader, but for some reason it doesn't allow you to load an html page. And it really makes no sense why this functionality would not exist. Maybe Microsoft threatened to destroy them if they included it, who knows.

                L 1 Reply Last reply
                0
                • F Force Code

                  Just to be clear, you can load another flash page into any other flash page without any problem, using something called SWFLoader. There's also something called URLLoader, but for some reason it doesn't allow you to load an html page. And it really makes no sense why this functionality would not exist. Maybe Microsoft threatened to destroy them if they included it, who knows.

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  Force Code wrote:

                  And it really makes no sense why this functionality would not exist.

                  Ok, good luck

                  led mike

                  1 Reply Last reply
                  0
                  • F Force Code

                    I've been doing Flex and AS3 programming for about five months, but now I'm having to delve into Javascript with which I have no experience. I have what I think is a very basic Javascript question. My basic terminology may not even be accurate, but I think I want to resize the 'document' as opposed to the window. For at least some browsers, I think you can say window.Resize(x,y) and it will resize the actual browser window. However, I want to resize not the window, but rather the scrollable area of the page, regardless of what text or other content the page actually contains. So if all the page contains is "Hello World", I want to be able to resize the scrollable area to some arbitrary size, so that maybe it could be scrolled down for several pages. Contrarily, I want to be able to set the width of the page to less (or greater) than the width of the browser window width, so that presumably there could be a blank area between the right edge of the page and the right edge of the browser window. I also want to be able to set the scroll position of the page, And also if possible the option to show or hide the scroll bars, regardless of the document size. I spent three hours last night trying to find this information without success. I was trying to do the above on the onLoad event in the body tag (calling a javascript function defined in a previous script section.)

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Does this serve your purpose?

                    html = document.getElementById('ht'); html.style.height="200%";

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups