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
    Feb 2004
    Location
    Germany
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with script off JavaScriptKit.com

    Hello, I'm new here and I don't know whether this is the right place to post this, but I couldn't find anyplace else it would fit...

    I have several thumbnails on my site, and by clicking on them I want each of them to open up the full-sized picture in a popup window - therefore I copied the script that generates a popup window off javascriptkit.com.

    The problem is, only the last thumbnail loads the correct page into a popup window. In fact, each of the thumbnails opens the same page that I want to be loaded by clicking on the last of them, so only the very last link seems to work...

    I hope you understand what I mean, please forgive my English...

    Is there a script that runs without these errors or is there any way I can correct the existing script?

    Thank you very much in advance,
    Lúthien

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Help if you poated the code that you modified
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <script>

    function openpopup(){
    var popurl="url.html"
    winpops=window.open(popurl,"","width=500,height=500,")
    }

    </script>

    <a href="javascript:openpopup()">
    <img src="thumbnail.png" width="500" height="440" alt="click to enlarge" border="0"></a>


    ----------

    The code was generated for me at javascriptkit.com. I simply replaced the text link with a thumbnail and changed the url of the page to be loaded into the window.

    I checked every page and their links, but which ever thumbnail I click on, always the page that the last thumbnail links to will be shown.

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this:
    Code:
    <script type="text/javascript">
    function openpopup(url){
    winpops=window.open(url,"","width=500,height=500,")
    }
    </script>
    </HEAD>
    
    <BODY>
    <a href="LARGE_IMAGE.png" onclick="openpopup(this.href);return false">
    <img src="thumbnail.png" width="500" height="440" alt="click to enlarge" border="0"></a>
    .....Willy

  • #5
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much, it absolutely works the way I want it to.
    Thanks for your quick reply!

    By the way, is there a way of making the popup window open in the center of the screen?

  • #6
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you want the absolute center for various screen resolutions you will need to search the net for one of the hundreds of pre-written scripts which does this. The below will center it good enough for 768X1024.

    winpops=window.open(url,"","top=175,left=250,width=500,height=500,")

    .....Willy


  •  

    Posting Permissions

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