Results 1 to 4 of 4

Thread: onload body issue. Need help

  1. #1
    Join Date
    Feb 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry onload body issue. Need help

    I am currently updating an online form and to do the follwoing:

    This form is posted once a month via a link from the homepage but also from our forums. I want to know what code I need to add so that no matter how the form is accessed (Its a HTML form) when the new window opens it will resize and remove the toolbars, scrollbars and menu bars.

    I want it to be done via onload. from what I have read this can be done and so far Ive managed to code it so that everytime the page loads it opens in a new window at 610x370 and the scrollbars dissapear but I cant for the life of me remove the toolbars and menu bars. I know this would be impossible if I was trying to load the form in the same parent window but I am trying to load it into a new window and I just cant get it to work.

    Here is the code im using:

    <script language="javascript">
    function resizeWindow()
    {
    window.resizeTo(610,370)
    }
    </script>

    <body onload="resizeWindow()" scroll=no>

    Many Thanks to who ever can help me as I am really stuck.

  2. #2
    Join Date
    Feb 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    can any one help me at at all please? 130 views and no one knows the answer?

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    This might suit your needs: http://www.dynamicdrive.com/dynamici...autocenter.htm

    Rather than worry about resizing a window after it opens, I think it would be easier to specify the size, etc. in the onclick event from the preceding page.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Couldn't you just use an iframe? Something like:
    Code:
    <script type="text/javascript">
    function iframe_popup(){
    var iframe_pop=document.createElement('iframe');
    iframe_pop.setAttribute("scrolling", "no");
    iframe_pop.setAttribute("frameBorder", "no");
    iframe_pop.setAttribute("width", 610);
    iframe_pop.setAttribute("height", 370);
    iframe_pop.style.border="1px solid black";
    iframe_pop.style.position="absolute";
    iframe_pop.style.left="50%";
    iframe_pop.style.top="50%";
    iframe_pop.style.marginLeft="-305px";
    iframe_pop.style.marginTop="-185px";
    iframe_pop.setAttribute("src", "http://www.google.com");
    document.body.appendChild(iframe_pop);
    }
    window.onload=iframe_popup;
    </script>
    But I don't know if that's what you want.
    Note: the part in red is needed if you want to center the iframe.
    ===
    Arie Molendijk.
    Last edited by molendijk; 02-28-2011 at 10:38 PM. Reason: Added remark about centering the iframe.

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
  •