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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cant get simple java image scroll script to work

    Hi there,

    I just fiddle on photoshop and with dreamweaver as a hobby and i've put my hand up to make a website for the local rugby league team...

    I've essentially just thrown together a bunch of open source scripts to get the site working and up until this morning this was working fine for me, but for some reason i cannot get this simple image scroll script to work...

    When i upload the file on it's own it works fine;
    http://www.shellharbourcityrlfc.com/tmp/Scroller.php

    But when i try and add all the code to the page i want it on, it just stands static;
    http://www.shellharbourcityrlfc.com/tmp/index.php


    I'm assuming it's something to do with conflicting java staff but i have no idea how it all works...

    would greatly appreciate some help...

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,495
    Thanks
    3
    Thanked 500 Times in 487 Posts
    that code is very old and will not work on a page with other images

    try

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    #tst {
      position:absolute;overflow:hidden;left:0px;top:10px;width:100%;height:100px;
    }
    
    #tst IMG {
      width:100px;height:100px;border-Width:0px;
    }
    
    #tstH {
      position:absolute;overflow:hidden;left:100px;top:120px;width:100px;height:400px;border:solid red 1px;
    }
    
    #tstH IMG {
      width:100px;height:100px;border-Width:0px;
    }
    
    /*]]>*/
    </style>
    
    </head>
    
    <body>
    <div id="tst" onmouseover="zxcMarquee.Pause('tst');" onmouseout="zxcMarquee.Auto('tst',-2);" >
    
    </div>
    <div id="tstH" onmouseover="zxcMarquee.Pause('tstH');" onmouseout="zxcMarquee.Auto('tstH',-2);" >
    
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // Simple Marquee (16-September-2013)
    // by: Vic Phillips - http://www.vicsjavascripts.org.uk/
    
    
    var zxcMarquee={
    
      Auto:function(id,s,ms){
       var o=this['zxc'+id],oop=this;
       o.to=setTimeout(function(){ o.ud=typeof(s)=='number'?s:o.ud; oop.scroll(o); },typeof(ms)=='number'&&ms>=0?ms:100);
      },
    
      Pause:function(id){
       var o=this['zxc'+id];
       o?clearTimeout(o.to):null;
      },
    
      init:function(o){
       var id=o.ParentID,ia=o.ImageArray,m=o.Mode,ud=o.Speed,au=o.AutoScroll,p=document.getElementById(id);
       if (p){
        var s=document.createElement('DIV'),m=typeof(m)=='string'&&m.charAt(0).toUpperCase()=='V'?['top','height','left']:['left','width','top'],i,a,ary=[],z0=0;
        s.style.position='absolute';
        s.style[m[2]]='0px'
        s.style[m[1]]='30000px';
        p.appendChild(s);
        for (;z0<ia.length;z0++){
         if (ia[z0]&&typeof(ia[z0][0])=='string'){
          a=document.createElement('A');
          typeof(ia[z0][2])=='string'?a.href=ia[z0][2]:null;
          i=document.createElement('IMG');
          i.src=ia[z0][0];
          typeof(ia[z0][1])=='string'?i.title=ia[z0][1]:null;
          a.appendChild(i);
          s.appendChild(a);
          ary.push([a,i]);
         }
        }
        o.m=m;
        o.s=s;
        o.ary=ary;
        o.lgth=ary.length-1;
        o.n=0;
        o.ud=typeof(ud)=='number'?ud:1;
        o.lft=o.ud<0?o.ary[0][1][m[1]]:0;
        s.style[m[0]]=o.lft+'px';
        this['zxc'+id]=o;
        typeof(au)=='number'&&au>=0?this.Auto(id,o.ud,au):null;
       }
      },
    
      scroll:function(o){
       clearTimeout(o.to);
       var oop=this,lft=o.lft+o.ud,n=o.n;
       if ((o.ud<0&&lft<0)||(o.ud>0&&lft>o.ary[n][1][o.m[1]])){
        o.ud<0?o.s.appendChild(o.ary[n][0]):null;
        lft=o.ud<0?o.lft+o.ary[n][1][o.m[1]]:0;
        n+=o.ud<0?1:-1;
        n=n>o.lgth?0:n<0?o.lgth:n;
        o.ud>0?o.s.insertBefore(o.ary[n][0],o.ary[o.n][0]):null;
        o.n=n;
       }
       o.s.style[o.m[0]]=lft+'px';
       o.lft=lft;
       o.to=setTimeout(function(){ oop.scroll(o); },50);
      }
    }
    
    zxcMarquee.init({
     ParentID:'tst',    // the unique ID name of the parent DIV.                           (string)
     ImageArray:[       // an array of arrays defining the images SRC's, titles and HREFs. (array)
    //  field 0 = the image SRC.
    //  field 1 = (optional) the image title.
    //  field 2 = (optional) the image HREF.
      ['http://www.vicsjavascripts.org.uk/StdImages/0.gif','image 0','http://www.shellharbourcityrlfc.com/tmp/logos/java.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/1.gif','image 1','http://www.shellharbourcityrlfc.com/tmp/logos/php.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/2.gif','image 2','http://www.shellharbourcityrlfc.com/tmp/logos/mysql1.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/3.gif','image 3','http://www.shellharbourcityrlfc.com/tmp/logos/html5.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/4.gif','image 4','http://www.shellharbourcityrlfc.com/tmp/logos/css.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/5.gif','image 5','http://www.shellharbourcityrlfc.com/tmp/logos/javascript.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/6.gif','image 6','http://www.shellharbourcityrlfc.com/tmp/logos/ui.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/7.gif','image 7','http://www.shellharbourcityrlfc.com/tmp/logos/jquery.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/8.gif','image 8','http://www.shellharbourcityrlfc.com/tmp/logos/joomla.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/9.gif','image 9','http://www.shellharbourcityrlfc.com/tmp/logos/android.png']
     ],
     Mode:'Horizontal', //(optional) the display mode, 'Horizontal' or 'Vertical'.         (string, default = 'Horizontal')
     Speed:-2,          //(optional) the display mode, 'Horizontal' or 'Vertical'.         (string, default = 'Horizontal')
     AutoScroll:1000    //(optional) the delay before starting scoll.                      (number, default = no auto scroll)
    });
    
    zxcMarquee.init({
     ParentID:'tstH',
     ImageArray:[
      ['http://www.vicsjavascripts.org.uk/StdImages/0.gif','image 0','http://www.shellharbourcityrlfc.com/tmp/logos/java.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/1.gif','image 1','http://www.shellharbourcityrlfc.com/tmp/logos/php.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/2.gif','image 2','http://www.shellharbourcityrlfc.com/tmp/logos/mysql1.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/3.gif','image 3','http://www.shellharbourcityrlfc.com/tmp/logos/html5.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/4.gif','image 4','http://www.shellharbourcityrlfc.com/tmp/logos/css.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/5.gif','image 5','http://www.shellharbourcityrlfc.com/tmp/logos/javascript.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/6.gif','image 6','http://www.shellharbourcityrlfc.com/tmp/logos/ui.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/7.gif','image 7','http://www.shellharbourcityrlfc.com/tmp/logos/jquery.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/8.gif','image 8','http://www.shellharbourcityrlfc.com/tmp/logos/joomla.png'],
      ['http://www.vicsjavascripts.org.uk/StdImages/9.gif','image 9','http://www.shellharbourcityrlfc.com/tmp/logos/android.png']
     ],
     Mode:'Vertical',
     Speed:2,
     AutoScroll:1000
    });
    
    /*]]>*/
    </script>
    
    
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/


  •  

    Posting Permissions

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