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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    POP-UPS: Sizes, fit to screen?

    First of all, I am sorry about my terrible English, and I also soo sorry about my nooby knowladge in JS.

    I have tried to make a pop-up window, which I did, but I had the following problems:

    1. I can't make the pop-up to fit the source image size (which is 800*600).
    I mean, I did gave the pop-up the parameters of width an height, but I want it to be fixed to a maximum size of 800*600, but also can be resized to a lower resolution than 800*600 only if needed.
    (In the client has a screen resolution of 640*320, he could decrease the size of the pop-up, but can't increase more then 800*600)

    2. If nm.1 is impossible (I hope it is possible), I want it to be atleast opened to fit automaticly the client's screen. (not fullscreen, browsers inner limits)

    3. If nm.1 is possible, How do I make the pop-up align to the center of the screen? (of anykind of screen and for all of the possible resolutions, no matter if its 800*600 or 1280*1024)

    This is the full source of the document, which has an image in it called "1" and on clicking the image, it opens exactly the same one in a pop-up window.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
    background-color: #000000;

    }
    -->
    </style></head>

    <body>
    <div align="center"><a href="javascript:void(0)" onclick="window.open('1.jpg','1','menubar=no,width=screen.width,height=screen.height,left = 200, top = 262,status=no,location=no,toolbar=no,scrollbars=yes,resizable=1')" ><img src="1.jpg" width="767" height="575" border="0"/></a></div>
    </body>
    </html>
    Sorry for beeing a nudge or whatever I am (go ahead an call me names),
    but I am just a beginner and I realy need your help

    Thank you,
    Xero1997
    Last edited by Xero1997; 09-07-2008 at 04:27 PM. Reason: Topic

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Your English is certainly not terrible - it is a lot better than some native speakers on this forum.

    I don't think that it is possible to make the image resizeable downwards but not upwards.

    Try this:-

    Code:
    <script type="text/javascript">
    
    var win = null;
    function NewWindow(mypage,myname,w,h,scroll) {
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings =
    'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
    win = window.open(mypage,myname,settings);
    }
    
    </script>
    
    <a href="#" onclick="NewWindow('http://www.yoursite.com/page.html','myPop','800','600','Loading');" > Click Here For Popup </a>

    The Moving Finger writes; and, having writ,
    Moves on: nor all your piety nor wit
    Shall lure it back to cancel half a line,
    Nor all your tears wash out a word of it.

    -- Omar Khayyam
    Last edited by Philip M; 09-07-2008 at 04:40 PM.

  • #3
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Your English is certainly not terrible - it is a lot better than some native speakers on this forum.

    I don't think that it is possible to make the image resizeable downwards but not upwards.

    Try this:-

    Code:
    <script type="text/javascript">
    
    var win = null;
    function NewWindow(mypage,myname,w,h,scroll) {
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings =
    'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
    win = window.open(mypage,myname,settings);
    }
    
    </script>
    
    <a href="#" onclick="NewWindow('http://www.yoursite.com/page.html','myPop','800','600','Loading');" > Click Here For Popup </a>

    The Moving Finger writes; and, having writ,
    Moves on: nor all your piety nor wit
    Shall lure it back to cancel half a line,
    Nor all your tears wash out a word of it.

    -- Omar Khayyam
    I tired this, but how do I make it work, it shows me error on page.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by Xero1997 View Post
    I tired this, but how do I make it work, it shows me error on page.
    Well it works for me (of course you must put in the appropriate URL.)
    What is the error message you receive?

  • #5
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Well it works for me (of course you must put in the appropriate URL.)
    What is the error message you receive?
    Just Error of Page. (in the status bar)
    But... where do I need to enter the URL's? (I am a nooby soo... )

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    There is a much better cut-and paste script at:-

    http://www.javascriptkit.com/script/...opimage2.shtml


  •  

    Tags for this Thread

    Posting Permissions

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