Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I make a popup window reshape according to screen area size?

    Alright, I could use alittle help on this one if anyone knows how to do it. What I want to do is get a popup window to reshape itself to fit accordly to different browsers screen area size.

    What I am using the code for is an online auction site, where I have a small picture in my auctions and when the picture is clicked it opens up a larger version of the picture in a window, and has a close this window link in the popup for easily closing it.

    The only problem I'm having is when I test it on different screen area sizes it's not showing the whole popup. Like for instance on a 600-800 it won't show the close the window link. Or the window will be to large to even see the whole picture. I tried putting in a scrolling bar but that didn't work either.


    The script I used in the heading is this:

    <SCRIPT language="JavaScript">
    <!--
    function Popup()
    {
    var popupURL ="EDITED";
    var popup = window.open(popupURL,"Popup",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,res izable=0,width=500,height=500');
    if( navigator.appName.substring(0,8) == "Netscape" )
    {
    popup.location = popupURL;
    }
    }
    // -->
    </SCRIPT>

    I pulled that script off a tutorial site, as I wasn't to knowledgeable of javascript when I first started this project.

    I use this script as the link where my picture is on the auction:

    <A HREF="javascript:Popup()" ><img src="EDITED" height=100 width=100></A>

    I pulled that off the same tutorial site. I messed around with the width and height attributes for awile but I don't know if those are whats affecting the way it's viewed. I edited out the the picture and url I used, but if it's needed I'll put them back in.

    I want to thank anyone ahead of time for any responses to my question. I really appreciate you taking the time to try and help me out.

  • #2
    New Coder
    Join Date
    Jul 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try the following


    <SCRIPT language="JavaScript">
    <!--
    Width=screen.width
    Height=screen.height
    function Popup(){
    var popupURL ="EDITED";
    var popup = window.open('popupURL','Popup' ,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+Width+",hei ght="+Height+"');
    if( navigator.appName.substring(0,8) == "Netscape" ){
    popup.location = popupURL;
    }
    }
    // -->
    </SCRIPT>
    <A HREF="javascript:Popup()" ><img src="EDITED" height=100 width=100></A>

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That doesn't seem to work. The popup doesn't open now. When I click on the picture that is supposed to open the popup I get error on page message on the very bottom bar.

    Am I supposed to specifiy the exact width and height I want the popup to open to?

  • #4
    New Coder
    Join Date
    Jul 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you will find the script will work.
    The problem is how the text in this textbox is wrapped.

    I copied and pasted the above script and got an error because the window.open line had been broken.

    the following should be one line

    var popup = window.open('popupURL','Popup' ,'toolbar=0,location=0,directories=0,status=0,menu
    bar=0,scrollbars=0,resizable=0,width="+Width+",height="+Height+"');

    I've attached a text file with the code in.
    Attached Files Attached Files

  • #5
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want to thank you so much for getting that popup to work right.

    Only problem I have now is the popup isn't showing the picture anymore. Just a cannot find server message.


  •  

    Posting Permissions

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