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
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PopUP? Parent,Top,Blank,....... which to use?

    ok i i need to acomplish something here and i think javascript might be my best answer. What i'm trying to do is when a user clicks on a image i would like for a pop up to show a larger image.... no problems there... i've been using _blank as the target. now the problem i'm having is reusing the same window. the last thing i want is the end-user having 15 pop-ups on the browser when their finished look at my page. so if someone could offer some advice on how to do this it would be great.


    Thanks in Advance

    ROB

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You can pass the same window name to each window you open:
    PHP Code:
    <html>
    <
    head>
    <
    script type="text/javascript">
    function 
    popWin(urlname)
    {
        
    window.open(urlnameheight="200"width="200");
    }
    </script>
    </head>
    <body>
    <form name="" action="" method="">
    <input type="button" value="Google" onclick="popWin('http://www.google.com', 'Google');"><br>
    <input type="button" value="Coding Forums" onclick="popWin('http://www.codingforums.com', 'Google');">
    </form>
    </body>
    </html> 

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thank brando, BUT....

    i'm actually looking for a javascript, also i was thinking it may be as simple as opening a specifiy window ( or one i name maybe) i'm just not sure i how or what i'm trying to do

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Perhaps you can explain, I don't get what you mean?

  • #5
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks again

    here is what i've got up http://z-netics.com/shiloh/rob/robshilohleft.htm what i would like to do is, when the user click on an image i would like a pop that displays a larger version of that image, but i want to use the same window if the click on another image. thus avoiding too many popup window being opened. oh jea i used a little program simauar to flash called swish and i can add java script to each individual image


    PS. i Added you to my msn messenger
    robwri32@hotmail.com

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    maybe this script will suffice?
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title></title>
    <script type="text/javascript">
    function writeimg(imageURL,what,wid,hgt)
    {
    sh=(screen.height-hgt)/2;
    sw=(screen.width-wid)/2;
    imgWin = window.open('','imgWin','width='+wid+',height='+hgt+',top='+sh+',left='+sw+'');
    imgWin.document.write('<html><head><title>'+what+'</title>');
    imgWin.document.write('<style type="text/css"><!-- body { margin: 0px;padding:0px; } --></style></head>');
    imgWin.document.write('<body><img src="'+imageURL+'" width="'+wid+'" height="'+hgt+'"></body></html>');	
    imgWin.document.close();
    imgWin.self.focus();
    imgWin.window.resizeTo(wid,hgt);
    imgWin.window.moveTo(sw,sh);
    }
    </script>
    </head>
    <body>
    <a href="smallimage1.jpg" onClick="writeimg(this.href,'the title is here','438','80');return false">Big Image1</a>
    <a href="smallimage2.jpg" onClick="writeimg(this.href,'different title','150','150');return false">Big Image2</a>
    </body>
    </html>


  •  

    Posting Permissions

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