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 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Popup using like naming convention

    I am building a website that contains several different image galleries--reptiles, birds, and mammals. Being graphic heavy I am displaying thumbnails of each picture. I would like the viewer to be able to click on the thumbnail to view the larger image in a popup window. I would rather not have to type the name of every photo. Can a Javascript be written that will open a window using the name of the thumbnail image by removing the thumbnail identifier? All my thumbnail have "_thumb" as their thumbnail status identifier.

    Example:
    thumbnail imaged named: frog_thumb.jpg
    larger image named: frog.jpg

    Can a script be written that will drop "_thumb" from an image name to open up the large image frog.jpg in a popup window?

    Thanks

    Togo

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    woohoo... that sounds like a cool website... have the URL?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.javascriptkit.com has one a popup image viewer, take a look pretty neat.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #4
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re: Popup using like naming convention

    Originally posted by Dave Clark


    var img = document.images["imageName"];
    var url = img.src;
    alert(url);
    url = url.split("_thumb").join("");
    alert(url);

    OK?

    Thanks for the reply Dave. I hate to admit I am a graphics person not a programer. Could you spell you code out more for me? What goes where etc. Basically, huh,...how do I use it?

    Togo

  • #5
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re: Re: Re: Popup using like naming convention

    Originally posted by Dave Clark


    OK. Let's see what your code, for your thumbnail, looks like.

    Here is a code for a lizard picture. File of course changes for snakes, birds, plants etc.

    <img src="/pictures/envior_pics/lizards/saurobes_thumb.jpg" width="175" height="97">

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by Dave Clark
    with this IMG tag content:

    <img src="/pictures/envior_pics/lizards/saurobes_thumb.jpg"
    width="175" height="97" onClick="return popupImage(this);">
    /me just a whispers® to dave...
    ummm does netscrap just a support® the onClick in the 'img' tag??? /me doesnt seem to remember thinkin' it does??? /me thinks it hasss to be in the <a href="#" onClick="return popupImage(this);">your thumb here</a>
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by Dave Clark
    OK?
    dave...
    just a yep® hehehe...
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could alternatively reverse the way you look at the needs
    and use doc writes to do most

    PHP Code:
    basefolder "mysite/images/lizards/";
    imges = new Array("yellow","red","blue","ghecko");

    function 
    popme(imgname) {
    win window.open(basefolder+imgname+'.jpg','win','width=440,height=340,resizable');
    win.focus();
    }

    for (
    j=0;j<imges.length;j++) {
    if (
    j=2) {document.write('<br>');}
    document.write('<a href="javascript:popme(\''+basefolder+imges[j]+'_thumb.jpg"><img src="'+basefolder+imges[j]+'.jpg" border="0"></a>');

    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    weird - it wrote in a smilie code :P

    document.write('<a href="javascript: popme(''+basefolder+imges[j]+'_thumb.jpg"><img src="'+basefolder+imges[j]+'.jpg" border="0"></a>');
    }

    without the space in javascript: popme
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    poot...
    "quote...Ökii - formerly pootergeist...endquote"

    heyyy did/do you just a know® prince??? lol...
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support


  •  

    Posting Permissions

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