Web Analytics Made Easy -
StatCounter Popup using like naming convention - CodingForum

Announcement

Collapse
No announcement yet.

Popup using like naming convention

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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. ;)

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          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">

          Comment


          • #6
            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

            Comment


            • #7
              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

              Comment


              • #8
                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.

                Comment


                • #9
                  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.

                  Comment


                  • #10
                    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

                    Comment

                    Working...
                    X