Announcement

Collapse
No announcement yet.

Javascript Image Help

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

    Javascript Image Help

    I have put a table in a brochure page fragment (my home page) and then nested a table in the table.

    I want to place a javascript slide show in the nested table (so that I can position the image exactly where I want it) e.g.

    <td>
    <table>
    <tr><td> javascript slide show</td></tr>
    </table>
    </td>

    I have tried free javascripts, but keep getting errors.

    Can anyone suggest a simple script (as cool as possible) and a method to enable me to insert it correctly so it works.

    I have already put a bookmark javascript in the fragment and that works and I have put a ticker javascript into Act_Brochure_Primary and that works so I must be doing something wrong.

    Any help appreciated

    Rob
    Rob Lane
    www.DATARAX.co.uk

    #2
    Look at your page in Firefox (www.mozilla.org) and use it's Tools / JavaScript Console to get meaningfull error messages.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Originally posted by NormanRouxel
      Look at your page in Firefox (www.mozilla.org) and use it's Tools / JavaScript Console to get meaningfull error messages.
      Hi Norman,
      Thanks, tried that and firefox comes up with the error message "invalid assignment left-hand side" which i have highlighted below in red.

      Any thoughts on why NETQUOTEVAR is there as it was not in the script when I pasted it in.

      <script language="javascript">

      /*
      Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
      For this script and more, visit http://www.javascriptkit.com
      */

      var delay=1000 //set delay in miliseconds
      var curindex=0
      var curindex=0
      var randomimages=new Array()
      randomimagesNETQUOTEVAR:0="../shelving.gif"
      randomimagesNETQUOTEVAR:1="../racks.gif"
      randomimagesNETQUOTEVAR:2="../shelving.gif"
      randomimagesNETQUOTEVAR:3="../racks.gif"
      randomimagesNETQUOTEVAR:4="../shelving.gif"
      randomimagesNETQUOTEVAR:5="../racks.gif"
      var preload=new Array()
      for (n=0;n<randomimages.length;n++)
      {
      preload[n]=new Image()
      preload[n].src=randomimages[n]
      }
      document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
      function rotateimage()
      {
      if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
      curindex=curindex==0? 1 : curindex-1
      }
      else
      curindex=tempindex
      document.images.defaultimage.src=randomimages[curindex]
      }
      setInterval("rotateimage()",delay)

      </script>

      Any futher help welcome

      Kind regards

      Rob

      http://www.datarax.co.uk/
      Rob Lane
      www.DATARAX.co.uk

      Comment


        #4
        Post what you actually pasted in. Put it between [ code ] and [ code ] tags (without the spaces) to preserve the layout.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Put it between [ code ] and [ code ] tags
          That will actually be [ code ] and [ /code ] with no space between the square brackets [ and the characters inside them
          Bill
          www.egyptianwonders.co.uk
          Text directoryWorldwide Actinic(TM) shops
          BC Ness Solutions Support services, custom software
          Registered Microsoft™ Partner (ISV)
          VoIP UK: 0131 208 0605
          Located: Alexandria, EGYPT

          Comment


            #6
            I'm sure Rob's using this, straight from the javascriptkit.com site:
            Code:
            <script language="javascript">
            
            /*
            Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
            For this script and more, visit http://www.javascriptkit.com
            */
            
            var delay=1000 //set delay in miliseconds
            var curindex=0
            
            var randomimages=new Array()
            
            	randomimages[0]="1.jpg"
            	randomimages[1]="5.jpg"
            	randomimages[2]="2.jpg"
            	randomimages[3]="4.jpg"
            	randomimages[4]="3.jpg"
            	randomimages[5]="6.jpg"
            
            var preload=new Array()
            
            for (n=0;n<randomimages.length;n++)
            {
            	preload[n]=new Image()
            	preload[n].src=randomimages[n]
            }
            
            document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
            
            function rotateimage()
            {
            
            if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
            curindex=curindex==0? 1 : curindex-1
            }
            else
            curindex=tempindex
            
            	document.images.defaultimage.src=randomimages[curindex]
            }
            
            setInterval("rotateimage()",delay)
            
            </script>
            
            <p align="center"><font face="arial" size="-2">This free script provided by</font><br>
            <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
            Kit</a></font></p>

            Comment


              #7
              Originally posted by drounding
              I'm sure Rob's using this, straight from the javascriptkit.com site:
              Code:
              <script language="javascript">
              
              /*
              Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
              For this script and more, visit http://www.javascriptkit.com
              */
              
              var delay=1000 //set delay in miliseconds
              var curindex=0
              
              var randomimages=new Array()
              
              	randomimages[0]="1.jpg"
              	randomimages[1]="5.jpg"
              	randomimages[2]="2.jpg"
              	randomimages[3]="4.jpg"
              	randomimages[4]="3.jpg"
              	randomimages[5]="6.jpg"
              
              var preload=new Array()
              
              for (n=0;n<randomimages.length;n++)
              {
              	preload[n]=new Image()
              	preload[n].src=randomimages[n]
              }
              
              document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
              
              function rotateimage()
              {
              
              if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
              curindex=curindex==0? 1 : curindex-1
              }
              else
              curindex=tempindex
              
              	document.images.defaultimage.src=randomimages[curindex]
              }
              
              setInterval("rotateimage()",delay)
              
              </script>
              
              <p align="center"><font face="arial" size="-2">This free script provided by</font><br>
              <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
              Kit</a></font></p>
              You are absolutely correct, I have to borrow things as I don't have a clue about how to do things most of the time (I just know I want to do them) so its easier to blagg a solution and sometimes it works and sometime as in this case it doesn't.

              But perhaps somebody can change that for me, now that the actual code is shown.

              Kind regards

              Rob
              Rob Lane
              www.DATARAX.co.uk

              Comment


                #8
                I've seen this with other javascript recently. The Actinic parser is supposed to ignore HTML / Script between !!< >!! tags. However it appears to fall over on Javascript arrays with an integer key so randomimages[0] becomes randomimagesNETQUOTEVAR:0

                This is one for the development team I think.

                As a workaround, replace:

                Code:
                var randomimages=new Array()
                
                	randomimages[0]="1.jpg"
                	randomimages[1]="5.jpg"
                	randomimages[2]="2.jpg"
                	randomimages[3]="4.jpg"
                	randomimages[4]="3.jpg"
                	randomimages[5]="6.jpg"
                with:

                Code:
                var randomimages=new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg");
                Hope this helps
                Chris
                -----
                http://www.livingaidsonline.co.uk

                Comment


                  #9
                  Note that Chris's way will not only be neater but that the script doesn't care how many items you list. You don't have to have exactly 6.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Originally posted by NormanRouxel
                    Note that Chris's way will not only be neater but that the script doesn't care how many items you list. You don't have to have exactly 6.
                    Hi,

                    Worked a treat, thanks eversomuch for the assistance.

                    For some reasom though I had to put the full http address to get the images to load as using e.g. image1.gif actinic said ithe image was not there, but I had uploaded as an additional file, so I know it was.

                    Kind regards

                    Rob
                    Rob Lane
                    www.DATARAX.co.uk

                    Comment


                      #11
                      If memory serves (not in front of a PC with Actinic running!), Actinic uploads files you specify as 'addition files' to the /acatalog directory. Your brochure pages live in the root directory.

                      Rather than supplying the full url, just prefix each image with acatalog/

                      eg "acatalog/image1.gif"

                      HTH
                      Chris
                      -----
                      http://www.livingaidsonline.co.uk

                      Comment

                      Working...
                      X