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
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts

    Popup Image Viewer

    I wrote this a long time ago and it seems to get posted in the forums quite a bit so I figured I post it here for easy reference:

    Code:
    <script language="Javascript" type="text/javascript">
    <!--//
    function imageView(imgFile,imgTitle,imgWidth,imgHeight,winPosX,winPosY){ 
    preview = window.open("","","resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width="+imgWidth+",height="+imgHeight+",left="+winPosX+",top="+winPosY+"");
    preview.document.write('<html><head><title>'+imgTitle+' - Click to close - <\/title><\/head>'
    +'<body onBlur="self.focus();" marginWidth="0" marginHeight="0" topmargin="0" leftmargin="0">'
    +'<center>'
    +'<a href="java script:self.close()">'
    +'<img border="0" alt="Image loading please wait...." src="'+imgFile+'" width="'+imgWidth+'" height="'+imgHeight+'">'
    +'<\/a><\/center>'
    +'<\/body><\/html>');
    preview.document.close();
    }
    //-->
    </script>

    <!--// Parameter list as follows:
    Image File
    Title of Image
    Width of Image
    Height of Image
    Window Position X coordinate
    Window Position Y coordinate
    //-->



    Example of use:

    Code:
    <a href="javascript:imageView('images/australia08.jpg','Australian Limestone Desert',427,277,50,50)">
    <img src="images/australia08thumb.jpg" width="84" height="55" border="0" alt="Click for larger image"></a>
    If you want to use this download the attached text file instead of copying and pasting from the screen here. The forum keeps putting spaces in the coding when copying and pasting causing the script to have an error.
    Last edited by Spookster; 09-22-2002 at 05:10 PM.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    TEXAS . . . 'nuf said
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm glad you put this here, as I've had to copy it from my pages numerous times for the forums.

    One important note:
    While you can take the <script> portion and put it in an external JS file for use/calling on multiple pages, N6 blanks...and subsequently won't complete the function. Therefore, for cross-browser usage, the <script> part needs to be put in the <head> of each and every page upon which you want to use it.

    Thanks Spookster!
    Gordo
    "In the End, we will remember not the words of our enemies, but the silence of our friends."
    - Martin Luther King Jr. (1929-1968)

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Spookster -

    Your code is exactly what I was looking for, except there seems to be a problem when I use it. The script activates, but cannot find the image (checked image path of course, and made sure the image is THERE of course). Tried several things, but all I get is "URL not found on this server"

    Sorry to be so dense, I'm just a Javascript newbie. Maybe there is something basic I screwed up (I cut and pasted the code, but maybe something got screwed along the way). Frustrating, and probably a simple problem. Any help would be appreciated!

  • #4
    New Coder
    Join Date
    Jul 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Spookster -

    I found my error. Thanks for making me look twice!!

    The SoupNazi @ http://www.ChefOnTheEdge.com

  • #5
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nice code i had wrote something simalar and submited it here
    http://www.javascriptcity.com/script...sersub1012.htm

    It does the same thing as yours i think or very simalar.

    Nice to see other people think pop up image thumbs are a good thing. hehe.

    T.G.O.

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts

    Post Popup Image Viewer File

    Here is the attachment. Couldn't seem to put it in my original post
    Attached Files Attached Files
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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