Web Analytics Made Easy -
StatCounter Help with script off JavaScriptKit.com - CodingForum


No announcement yet.

Help with script off JavaScriptKit.com

  • Filter
  • Time
  • Show
Clear All
new 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,

  • #2
    Help if you poated the code that you modified
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


    • #3

      function openpopup(){
      var popurl="url.html"


      <a href="javascriptpenpopup()">
      <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
        Try this:
        <script type="text/javascript">
        function openpopup([color=red]url[/color]){
        <a href="[color=blue]LARGE_IMAGE.png[/color]" [color=red]onclick="openpopup(this.href);return false"[/color]>
        <img src="thumbnail.png" width="500" height="440" alt="click to enlarge" border="0"></a>


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