Results 1 to 5 of 5

Thread: text change script

  1. #1
    Join Date
    Jan 2012
    Location
    India
    Posts
    45
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default text change script

    www.cargo-office.com/login.aspx

    i am looking for a script like new arrivals, text changing automatically, please suggest me any similar script like this
    Last edited by djr33; 06-05-2012 at 04:52 PM. Reason: convert to text link

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    starter for 10

    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[*/
    #roll {
      position:relative;width:200px;height:200px;border:solid red 1px;
    }
    
    .letter {
      position:relative;width:20px;height:20px;border:solid red 1px;float:left;margin-Left:2px;margin-Top:2px;text-Align:center;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    <input type="button" name="" value="Re-Start" onmouseup="zxcRollTextStart('roll');" />
    <input type="button" name="" value="New Text" onmouseup="zxcRollTextStart('roll','tom **** harry');" />
    <div id="roll" >
    </div>
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // Roll Text (06-June-2012)
    // by Vic Phillips
    
    function zxcRollText(o){
      var p=document.getElementById(o.ID),char=o.Charactors,d=o.Display,ms=o.RollSpeed,ms=typeof(ms)=='number'?ms:500,hold=o.RollDuration,hold=typeof(hold)=='number'?hold:10000,ary=[],z0=0;
      for (;z0<d.length;z0++){
       ary[z0]=[document.createElement('DIV'),d.charAt(z0)];
       ary[z0][0].className=o.LetterClass;
       ary[z0][0].innerHTML=char.charAt(Math.floor(Math.random()*char.length));
       p.appendChild(ary[z0][0]);
       ary[z0]=new zxcTextRoll(ary[z0],char,ms,hold);
      }
      zxcRollText[o.ID]=ary;
     }
    
    function zxcRollTextStart(id,txt){
     var ary=zxcRollText[id],z0=0;
     if (ary){
      for (;z0<ary.length;z0++){
       clearTimeout(ary[z0].to);
       if (txt){
        ary[z0].letter[1]=txt.charAt(z0)||'';
       }
       ary[z0].srt=new Date();
       ary[z0].roll();
      }
     }
    }
    
    function zxcTextRoll(letter,char,ms,hold){
     var oop=this;
     this.letter=letter;
     this.char=char;
     this.ms=ms;
     this.hold=hold;
     this.srt=new Date();
    }
    
    zxcTextRoll.prototype.roll=function(){
     var oop=this;
     if (new Date()-oop.srt<oop.hold){
      oop.letter[0].innerHTML=oop.char.charAt(Math.floor(Math.random()*oop.char.length))
      oop.to=setTimeout(function(){ oop.roll(); },oop.ms);
     }
     else {
      oop.letter[0].innerHTML=oop.letter[1];
     }
    }
    
    zxcRollText({
     ID:'roll',
     LetterClass:'letter',
     Charactors:'ABCDEFGHIJKLMNOPQRSTUVWXYZ  ',
     Display:'THIS IS THE TEXT',
     RollSpeed:500,
     RollDuration:10000
    });
    
    zxcRollTextStart('roll')
    /*]]>*/
    </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/

  3. The Following User Says Thank You to vwphillips For This Useful Post:

    ankush (06-07-2012)

  4. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    with split letters

    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[*/
    #roll {
      position:absolute;left:100px;top:100px;width:194px;height:50px;border:solid red 1px;
    }
    
    .letter {
      position:relative;width:20px;height:20px;border:solid red 1px;float:left;margin-Left:2px;margin-Top:2px;font-Size:18px;text-Align:center;background-Color:#FFFFCC;
    }
    
    .letterline {
      position:absolute;top:10px;left:0px;width:20px;height:1px;background-Color:#000000;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    <input type="button" name="" value="Re-Start" onmouseup="zxcRollTextStart('roll');" />
    <input type="button" name="" value="New Text" onmouseup="zxcRollTextStart('roll','tom **** harry');" />
    <div id="roll" >
    
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // Roll Text (06-June-2012)
    // by Vic Phillips
    
    function zxcRollText(o){
     var p=document.getElementById(o.ID),char=o.Charactors,d=o.Display,ms=o.RollSpeed,ms=typeof(ms)=='number'?ms:500,hold=o.RollDuration,hold=typeof(hold)=='number'?hold:10000,ary=[],c,h,z0=0;
     for (;z0<d.length;z0++){
      ary[z0]=[document.createElement('DIV'),d.charAt(z0)];
      p.appendChild(ary[z0][0]);
      ary[z0][0].className=o.LetterClass;
      h=parseInt(style(ary[z0][0],'height'))/2;
      c=document.createElement('DIV');
      ary[z0][0].appendChild(c);
      c.style.position='absolute';
      c.style.left='0px';
      c.style.top='0px';
      c.style.width='100%';
      c.style.height=h+'px';
      c.style.clip='rect(0px,100px,'+h+'px,0px)';
      c.innerHTML=char.charAt(Math.floor(Math.random()*char.length));
      c=c.cloneNode(true);
      ary[z0][0].appendChild(c);
      c.style.clip='rect('+h+'px,100px,100px,0px)';
      c.innerHTML=char.charAt(Math.floor(Math.random()*char.length));
      c=document.createElement('DIV');
      c.className=o.LineClass;
      ary[z0][0].appendChild(c);
     }
     zxcRollText[o.ID]=new zxcTextRoll(ary,char,ms,hold);
    }
    
    function style(o,p){
     if (o.currentStyle){
      return o.currentStyle[p.replace(/-/g,'')];
     }
     return document.defaultView.getComputedStyle(o,null).getPropertyValue(p.toLowerCase());
    }
    
    function zxcRollTextStart(id,txt){
     var oop=zxcRollText[id],ary,z0=0;
     if (oop){
      clearTimeout(oop.to);
      ary=oop.ary;
      for (;z0<ary.length;z0++){
       if (txt){
        ary[z0][1]=txt.charAt(z0)||'';
       }
      }
      oop.srt=new Date();
      oop.roll();
     }
    }
    
    function zxcTextRoll(ary,char,ms,hold){
     var oop=this;
     this.ary=ary;
     this.char=char;
     this.ms=ms;
     this.hold=hold;
     this.srt=new Date();
    }
    
    zxcTextRoll.prototype.roll=function(){
     var oop=this,ary=oop.ary,d,lgth=ary.length,run=new Date()-oop.srt<oop.hold,z0=0,z1;
     for (;z0<lgth;z0++){
      d=ary[z0][0].getElementsByTagName('DIV')
      for (z1=0;z1<2;z1++){
       d[z1].innerHTML=run?oop.char.charAt(Math.floor(Math.random()*oop.char.length)):ary[z0][1];
      }
     }
     if (run){
      oop.to=setTimeout(function(){ oop.roll(); },oop.ms);
     }
    }
    
    zxcRollText({
     ID:'roll',
     LetterClass:'letter',
     Charactors:'ABCDEFGHIJKLMNOPQRSTUVWXYZ  ',
     Display:'THIS IS THE TEXT',
     LineClass:'letterline',
     RollSpeed:500,
     RollDuration:10000
    });
    
    
    zxcRollTextStart('roll')
    /*]]>*/
    </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/

  5. The Following User Says Thank You to vwphillips For This Useful Post:

    ankush (06-07-2012)

  6. #4
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    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[*/
    #roll {
      position:absolute;left:100px;top:100px;width:276px;height:270px;border:solid red 1px;
    }
    
    .letter {
      position:relative;width:30px;height:30px;border:solid red 1px;float:left;margin-Left:2px;margin-Top:2px;font-Size:18px;text-Align:center;background-Image:url(alphabet.png);background-Position:-780px 0px;
    }
    
    .letterline {
      position:absolute;top:10px;left:0px;width:20px;height:1px;background-Color:#000000;
    }
    
    #roll2 {
      position:absolute;left:400px;top:100px;width:276px;height:270px;border:solid red 1px;
    }
    
    .letter2 {
      position:relative;width:20px;height:20px;border:solid red 1px;float:left;margin-Left:2px;margin-Top:2px;font-Size:18px;text-Align:center;background-Color:#FFFFCC;
    }
    
    /*]]>*/
    </style></head>
    
    <body>
    <input type="button" name="" value="Re-Start" onmouseup="zxcTextRoll.start('roll');" />
    <input type="button" name="" value="New Text" onmouseup="zxcTextRoll.start('roll',[27,28,29,30]);" />
    
    <input type="button" name="" value="Re-Start" onmouseup="zxcTextRoll.start('roll2',null,100,4000);" />
    <input type="button" name="" value="New Text" onmouseup="zxcTextRoll.start('roll2','123');" />
    
    <div id="roll" >
    
    </div>
    <div id="roll2" >
    
    </div>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // Text Roll (07-June-2012)
    // by Vic Phillips
    
    var zxcTextRoll={
    
     init:function(o){
      var p=document.getElementById(o.ID),char=o.Charactors,d=o.Display,bg=o.BackGroundImage,nu=o.MaximumLetters,cls=o.LetterClass,mde=typeof(d)=='string'&&typeof(char)=='string'?'txt':typeof(d)=='object'&&d.constructor==Array&&typeof(bg)=='string'&&typeof(nu)=='number'?'img':false,ms=o.RollSpeed,ms=typeof(ms)=='number'?ms:500,hold=o.RollDuration,hold=typeof(hold)=='number'?hold:10000,ary=[],c,h,w,obj,z0=0;
      if (mde&&p&&typeof(cls)=='string'){
       for (;z0<d.length;z0++){
        ary[z0]=[document.createElement('DIV'),mde=='img'?d[z0]:d.charAt(z0)];
        p.appendChild(ary[z0][0]);
        ary[z0][0].className=cls;
        h=parseInt(this.css(ary[z0][0],'height'))/2;
        w=parseInt(this.css(ary[z0][0],'width'));
        c=document.createElement('DIV');
        ary[z0][0].appendChild(c);
        c.style.position='absolute';
        c.style.left='0px';
        c.style.top='0px';
        c.style.width=w+'px';
        c.style.height=h*2+'px';
        c.style.clip='rect(0px,100px,'+h+'px,0px)';
        if (mde=='img'){
         c.style.backgroundImage='url('+bg+')';
         c.style.backgroundRepeat='no-repeat';
         c.style.backgroundPosition=-Math.floor(Math.random()*nu)*w+'px 0px';
        }
        else {
         c.innerHTML=char.charAt(Math.floor(Math.random()*char.length));
        }
        c=c.cloneNode(true);
        ary[z0][0].appendChild(c);
        c.style.clip='rect('+h+'px,100px,100px,0px)';
        if (mde=='img'){
         c.style.backgroundPosition=-Math.floor(Math.random()*nu)*w+'px 0px';
        }
        else {
         c.innerHTML=char.charAt(Math.floor(Math.random()*char.length));
        }
        c=document.createElement('DIV');
        c.className=o.LineClass;
        ary[z0][0].appendChild(c);
       }
       zxcTextRoll['zxc'+o.ID]=obj={
        mde:mde,
        ary:ary,
        nu:nu,
        w:w,
        char:char,
        ms:ms,
        hold:hold,
        srt:new Date()
       }
      }
     },
    
     roll:function(o){
      var oop=this,ary=o.ary,d,lgth=ary.length,run=new Date()-o.srt<o.hold,z0=0,z1;
      for (;z0<o.ary.length;z0++){
       d=o.ary[z0][0].getElementsByTagName('DIV')
       for (z1=0;z1<2;z1++){
        if (o.mde=='img'){
         d[z1].style.backgroundPosition=-(run?Math.floor(Math.random()*o.nu):o.ary[z0][1])*o.w+'px 0px';
        }
        else {
         d[z1].innerHTML=run?o.char.charAt(Math.floor(Math.random()*o.char.length)):o.ary[z0][1];
        }
       }
      }
      if (run){
       o.to=setTimeout(function(){ oop.roll(o); },o.ms);
      }
     },
    
     start:function(id,txt,ms,hold){
      var o=zxcTextRoll['zxc'+id],z0=0;
      if (o){
       clearTimeout(o.to);
       for (;z0<o.ary.length;z0++){
        if (txt){
         if (o.mde=='img'&&typeof(txt)=='object'&&txt.constructor==Array){
          o.ary[z0][1]=typeof(txt[z0])=='number'?txt[z0]:-1;
         }
         else if (o.mde=='txt'&&typeof(txt)=='string'){
          o.ary[z0][1]=txt.charAt(z0)||'';
         }
        }
       }
       o.srt=new Date();
       o.ms=typeof(ms)=='number'?ms:o.ms;
       o.hold=typeof(hold)=='number'?hold:o.hold;
       this.roll(o);
      }
     },
    
     css:function(o,p){
      if (o.currentStyle){
       return o.currentStyle[p.replace(/-/g,'')];
      }
      return document.defaultView.getComputedStyle(o,null).getPropertyValue(p.toLowerCase());
     }
    
    
    
    }
    
    
    
    zxcTextRoll.init({
     ID:'roll',
     LetterClass:'letter',
     Display:[
     19,7,8,18,26,8,18,26,19,7,4,26,19,4,23,19
     ],
     LineClass:'letterline',
     MaximumLetters:30,
     BackGroundImage:'alphabet.png',
     RollSpeed:500,
     RollDuration:10000
    });
    
    zxcTextRoll.start('roll');
    
    zxcTextRoll.init({
     ID:'roll2',
     LetterClass:'letter2',
     Charactors:'ABCDEFGHIJKLMNOPQRSTUVWXYZ  ',
     Display:'THIS IS THE TEXT',
     LineClass:'letterline',
     RollSpeed:500,
     RollDuration:10000
    });
    
    zxcTextRoll.start('roll2');
    
    /*]]>*/
    </script>
    
    </DIV>
    
    </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/

  7. The Following User Says Thank You to vwphillips For This Useful Post:

    ankush (06-07-2012)

  8. #5
    Join Date
    Jan 2012
    Location
    India
    Posts
    45
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default

    hmm thanks a lot, let me try this...

Bookmarks

Posting Permissions

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