Web Analytics Made Easy -
StatCounter How to keep slide show within frames - CodingForum

Announcement

Collapse
No announcement yet.

How to keep slide show within frames

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

  • How to keep slide show within frames

    I have used a slide show script on my main page which is framed. The slides are linked to urls within the site but when I click on the slides they go straight out of the frame.

    Here is the relevant code;
    <a href="javascript:gotoshow()" target="_top"><img src="/portal/html/thumbs/accountants2.gif" name="slide" border=0 width=88 height=100></a>
    <script>
    <!--

    //configure the paths of the images, plus corresponding target links
    slideshowimages("thumbs/accountants2.gif","thumbs/electricians2.gif","thumbs/alternative2.gif","thumbs/wedding2.gif","thumbs/rubbish2.gif")
    slideshowlinks("http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Accountants&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Electricians&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Alternative&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Wedding_Services&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Rubbish_Removal&md")

    Is there anything I can do to keep it within the frames?
    Sharon

  • #2
    <a href="javascript:gotoshow()" target="_top">

    delete that bit in bold.
    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


    • #3
      Re delete target = top

      Sorry I only put that there so it would stop the frame breaking when someone clicked on the image. When I remove it and someone clicks it goes straight out of the frame - with target =top absolutely nothing happens -

      Any more suggestions?
      Sharon

      Comment


      • #4
        well, hold on a minute. what exactly do you mean, by "going out of the frame" ? do you mean a new window is opening, or what is it that you mean?

        also, i think we definitely need to see the rest of your code, to figure out what's going on.
        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


        • #5
          About going out of frames

          yes you are right its opening a new page without the frame.

          Which bit of the code do you want ? that particular javascript?

          Heres the whole thing.
          <!--Special Effects upon page enter Script- © Dynamic Drive (www.dynamicdrive.com) For full source code, installation instructions, 100's more DHTML Scripts, and Terms Of Use, visit dynamicdrive.com--><META http-equiv="Page-Enter" CONTENT="RevealTrans(Duration=4,Transition=3)">
          <script language="JavaScript1.1">

          <!--



          var slideimages=new Array()
          var slidelinks=new Array()
          function slideshowimages(){
          for (i=0;i<slideshowimages.arguments.length;i++){
          slideimages[i]=new Image()
          slideimages[i].src=slideshowimages.arguments[i]
          }
          }

          function slideshowlinks(){
          for (i=0;i<slideshowlinks.arguments.length;i++)
          slidelinks[i]=slideshowlinks.arguments[i]
          }

          function gotoshow(){
          if (!window.winslide||winslide.closed)
          winslide=window.open(slidelinks[whichlink])
          else
          winslide.location=slidelinks[whichlink]
          winslide.focus()
          }

          //-->
          </script>

          <a href="javascript:gotoshow()"><img src="/portal/html/thumbs/accountants2.gif" name="slide" border=0 width=88 height=100></a>
          <script>
          <!--

          //configure the paths of the images, plus corresponding target links
          slideshowimages("thumbs/accountants2.gif","thumbs/electricians2.gif","thumbs/alternative2.gif","thumbs/wedding2.gif","thumbs/rubbish2.gif")
          slideshowlinks("/businessdirectory/ads.cgi?ct=Accountants&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Electricians&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Alternative&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Wedding_Services&md","http://www.crawleyontheweb.com/businessdirectory/ads.cgi?ct=Rubbish_Removal&md")

          //configure the speed of the slideshow, in miliseconds
          var slideshowspeed=3500

          var whichlink=0
          var whichimage=0
          function slideit(){
          if (!document.images)
          return
          document.images.slide.src=slideimages[whichimage].src
          whichlink=whichimage
          if (whichimage<slideimages.length-1)
          whichimage++
          else
          whichimage=0
          setTimeout("slideit()",slideshowspeed)
          }
          slideit()

          //-->
          </script>

          If you go to http://www.crawleyontheweb.com and scroll down to the bottom in the bottom right hand box under 'health' there is 'test' click on this and this page only contains the above code and you can see the new page opening.
          Sharon

          Comment


          • #6
            function gotoshow(){
            if (!window.winslide||winslide.closed)
            winslide=window.open(slidelinks[whichlink])
            else
            winslide.location=slidelinks[whichlink]
            winslide.focus()
            }

            there's your problem.

            try this instead:

            function gotoshow(){
            window.location=slidelinks[whichlink];
            }
            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


            • #7
              Tried it - doesn't work

              this is the code now
              <script language="JavaScript1.1">

              <!--



              var slideimages=new Array()
              var slidelinks=new Array()
              function slideshowimages(){
              for (i=0;i<slideshowimages.arguments.length;i++){
              slideimages[i]=new Image()
              slideimages[i].src=slideshowimages.arguments[i]
              }
              }

              function slideshowlinks(){
              for (i=0;i<slideshowlinks.arguments.length;i++)
              slidelinks[i]=slideshowlinks.arguments[i]
              }

              function gotoshow(){ window.location=slidelinks[whichlink];
              }

              else
              winslide.location=slidelinks[whichlink]
              winslide.focus()
              }

              //-->
              </script>

              Try it - it just errors now. - should I have removed the 'else' statement?
              Sharon

              Comment


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


                • #9
                  Oh wowy! It works!

                  Thanks so much - I have learnt something from this.
                  Sharon

                  Comment

                  Working...
                  X