Web Analytics Made Easy -
StatCounter I think I am doing something wrong... - CodingForum

Announcement

Collapse
No announcement yet.

I think I am doing something wrong...

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

  • I think I am doing something wrong...

    I have a simple page with a small table in it. It is a test page where I want people to click on a link, and that link will pop open a new smaller window and play a flash document.

    I have the coding pretty well, but when I have more than one item on the page, clicking on any link causes the last script listed to execute, instead of the correct one.

    Please check the source at

    www.imagineering-online.com/downloads.htm

    I have checked the syntax several times, and I cannot find anything wrong.

    Attached is a txt with some of the source in it.
    <p align="center">
    <FONT SIZE="2" FACE="helvetica,arial">
    You must have the
    <a target="new" href="http://www.macromedia.com/software/flashplayer/">Shockwave
    Flash</a> plug-in to view these animations.
    </FONT>

    </p>

    <div align="center">
    <center>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="77%" id="AutoNumber2">
    <tr>
    <td width="51%">
    <script>


    function openpopup(){
    var popurl="Files/alqaeda.swf"
    winpops=window.open(popurl,"","width=800,height=600,")
    }

    </script>

    <a href="javascriptpenpopup()">Al Qaeda Handbook</a></td>
    <td width="49%">

    <script>


    function openpopup(){
    var popurl="Files/osama_sissyfight.swf"
    winpops=window.open(popurl,"","width=800,height=600,")
    }

    </script>

    <a href="javascriptpenpopup()">Osama bin Laden Fight</a></td>
    <td width="49%">
    </tr>
    <tr>
    <td width="51%">
    <script>


    function openpopup(){
    var popurl="Files/humor_bin.swf"
    winpops=window.open(popurl,"","width=800,height=600,")
    }

    </script>

    <a href="javascriptpenpopup()">Osama song starring "GW"</a></td>
    <td width="49%">
    <script>


    function openpopup(){
    var popurl="Files/osama_video.swf"
    winpops=window.open(popurl,"","width=800,height=600,")
    }

    </script>

    <a href="javascriptpenpopup()">Osama bin Laden's "last" video</a></td>
    </tr>
    <tr>
    <td width="51%">
    <script>


    function openpopup(){
    var popurl="Files/finding_bin_laden.swf"
    winpops=window.open(popurl,"","width=800,height=600,")
    }

    </script>

    <a href="javascriptpenpopup()">Finding Osama bin Laden</a></td>
    </td>
    <td width="49%"><a href="Files/getosama.exe">Download and &quot;get&quot;
    Osama bin Laden</a></td>
    </tr>
    <tr>
    <td width="51%"><a href="Files/Dubya.avi">&quot;Dubya&quot; video</a>&nbsp;&nbsp;&nbsp;
    (Note: 5Mb File..Be Patient!)</td>
    <td width="49%">&nbsp;</td>
    </tr>
    </table>
    </center>
    </div>

    <p>&nbsp;</p>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber3">
    <tr>
    <td width="50%"><script>
    &nbsp;<a href="javascriptpenpopup()">Back Street Boys Parody</a></td>


    function openpopup(){
    var popurl="Files/bsbgay.swf"
    winpops=window.open(popurl,"","width=800,height=600,")
    }

    </script>
    &nbsp;<td width="50%">&nbsp;</td>
    </tr>
    <tr>
    <td width="50%">&nbsp;</td>
    <td width="50%">&nbsp;</td>
    </tr>
    </table>
    <p align="center">
    &nbsp;</p>
    <p align="center">
    &nbsp;</p>
    <p align="center">&nbsp;</p>

    <p align="center"></p>

    <p align="center"></p>

    </body>

    </html>


    Thanks for the help
    Last edited by jmacmillan; Jun 27, 2002, 11:16 AM.

  • #2
    well you have all the functions called the same thing. it'll use the last function and that's why you only get the one.
    Have one function
    <script>
    function openpopup(popurl){
    winpops=window.open(popurl,"","width=800,height=600,")
    }
    </script>

    and call it in your links
    <a href="javascriptpenpopup('Files/alqaeda.swf')">Al Qaeda Handbook</a>

    Also, remove the space in javascript.

    Comment


    • #3
      that's because you have the functions all named the same thing, so they're overwriting each other.

      what you could do instead, is have just one function, and tell it which page to open, like this:

      <script>
      function openpopup(popurl){
      winpops=window.open(popurl,"","width=800,height=600,")
      }
      </script>


      <a href="javascriptpenpopup('Files/alqaeda.swf');">Al Qaeda Handbook</a></td>
      bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

      i am a loser geek, crazy with an evil streak,
      yes i do believe there is a violent thing inside of me.

      Comment


      • #4
        we must've posted at the same time

        Comment


        • #5
          i think it's also interesting that we have nearly identical answers to the problem.

          granted, it's the right answer, but nonetheless.
          bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

          i am a loser geek, crazy with an evil streak,
          yes i do believe there is a violent thing inside of me.

          Comment


          • #6
            Works great...

            Thank you for your expertise. As you can tell, I am a bit of a novice at this.

            Is there some sort of general rule to follow when formatting this stuff to prevent this type of conflict?

            Comment

            Working...
            X