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
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    linking directly to a .jpg file

    on my website photo gallery I employ the standard technique of thumbnails linking direct to the file, which then just opens in a new browser window on plain white background.

    is there a way i can maybe change the style of the default target="_blank"....?

    im wondering if I can cheat so that the browser window might show a different default background color around the .jpg.

    Can any code do this...? I still want to link direct to the files coz i dont want to have to code loads of extra html pages to embed the photos in.

    Thanks
    Gazz

  • #2
    Regular Coder
    Join Date
    Dec 2002
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sorry

    My take on this... other than having a color behind your image, there is no way (that I can think of) of having what you have asked.

    Sorry, but theres still hope, mebbe some other guys will know

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Open a window and write into it

    newWin = open( ... etc

    newWin.document.write("<html> .... etc

    You can reuse the same code inifinitely by passing parameters for the image src, bgcolor, or whatever

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks brothercake....

    I get wot ur saying...

    Could u please help by demonstrating on the below example how it would work...

    <A href="images/nuyear44.jpg" target="_blank"><IMG src="thumbnails/nuyear44.jpg" border="0" alt="nuyear44"></A>

    The above will open the pic direct... im not sure how i can make it work how u say for all the different pics, there are around 200


  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    something like

    Code:
    function pictureWindow(imgSrc,imgW,imgH,imgName) {
    
    var picWin = open('','picWin','width='+(imgW+20)+',height='+(imgH+20)+',scrolling=no,status=yes,toolbars=no,menubar=no');
    
    var htm='';
    htm+='<html><head><title>'+imgName+'</title></head>';
    htm+='<body bgcolor="pink"><img src="'+imgSrc+'" width="'+imgW+'" height="'+imgH+'" alt="'+imgName+'"></body></html>';
    
    picWin.document.write(htm);
    
    }

    Then you call it like

    <a href="javascript:pictureWindow("image.jpg",200,250,"My Picture")>Click her to open this picture</a>


  •  

    Posting Permissions

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