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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Aug 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sliding Bilboard

    Does anyone have any idea how to recreate something like this in javascript:

    http://www.coxnetadstudio.com/slidin...rdblk_mkp.html

    Any advice you can give would be appreciated.

    THANKS!

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    answering now so I dont loose it

    but re
    http://www.webdeveloper.com/forum/sh...d.php?t=105086

    will post a working example tonight
    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
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    Code:
    <body onload="setTimeout('zxcCngHeight(\'Test1\',-1,10,300,100,true);',5000);" >
    
    <div id="Test1" style="position:relative;overflow:hidden;width:500px;height:300px;background-color:red;" >
    <img src="http://www.vicsjavascripts.org.uk/StdImages/One.gif" width=500 height:300 >
    </div>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Change Width/Height Part 1 Application Notes and Functional Code
    // by Vic Phillips (21-Feb-2006) http://www.vicsjavascripts.org.uk
    
    
    ............
    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/

  • #4
    New to the CF scene
    Join Date
    Aug 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Vic:

    Thanks for the help. I've uploaded the script verbatim here:

    http://www.ohiosportsfans.com/test.html

    but am getting a Java Script error after 5 seconds. Any idea what could be wrong?

    Thanks!

  • #5
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    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>
    </head>
    
    <body onload="setTimeout('zxcCngHeight(\'Test1\',-1,10,300,100,true);',5000);" >
    
    <div id="Test1" style="position:relative;overflow:hidden;width:500px;height:300px;background-color:red;" >
    <img src="http://www.vicsjavascripts.org.uk/StdImages/One.gif" width=500 height:300 >
    </div>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Change Width/Height Part 1 Application Notes and Functional Code
    // by Vic Phillips (21-Feb-2006) http://www.vicsjavascripts.org.uk
    
    
    // An elements width or height may be progressively changed or toggled
    // to a new specified dimension at specified increments at a specified speed.
    // The element may optionally removed (display:none;) when at the minimum dimension.
    
    // The script may be used for Multiple Level Menu and Rotate Image Cube applications.
    
    // There may be as many applications on a page as required.
    
    // Application Notes
    
    // The Code is in Three Parts
    
    // Part 1 - Application Notes and Functional Code
    // Part 2 - Multiple Level Menu applications.
    // Part 3 - Rotate Image Cube applications.
    
    // For Bespoke Application
    
    // To change the height: Executed by event call to zxcCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,true)
    // To toggle the height: Executed by event call to zxcCngHeightToggle(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,true)
    // To change the width:  Executed by event call to zxcCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,true)
    // To toggle the width:  Executed by event call to zxcCngWidthToggle(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,true)
    // where
    // parameter 0 = object or object ID name                                (object or string)
    // parameter 1 = the increment < 1 reduce height, > 1 increase height    (digits)
    // parameter 2 = the minimum height/height                               (digits)
    // parameter 3 = the maximum height/height                               (digits)
    // parameter 4 = (optional) delay (default 100mSec)                      (digits)
    // parameter 5 = (optional) true = remove element when at minimim height (true or null)
    
    // Note:
    //  Parameters 2,3 and 5 cannot be changed after the first element call
    //  The speed of execution is controlled by both parameter 1 and parameter 4
    
    // Table Applications
    // When applied to a table row the content of each <TD> must be nested in a <DIV>
    // with an inline style of position:relative;overflow:hidden;
    // e.g.
    //   <table>
    //    <tbody   >
    //     <tr >
    //      <td align="center"  onclick="zxcCngHeightToggle('Row2',1,20,130,5,true);" >
    //      <img src="http://www.vicsjavascripts.org.uk/StdImages/Up1.gif" ><img src="http://www.vicsjavascripts.org.uk/StdImages/Down1.gif" >
    //      </td>
    //     </tr>
    //     <tr height=100 id="Row2" style="display:none;" >
    //      <td align="left" valign="top">
    //      <div style="position:relative;overflow:hidden;top:0px;left:0px;width:100%;height:20px;text-align:center;" >
    //       <br>
    //       displayed with the 'toggle' event call from the TD above<br>
    //       <br>
    //        with progressive display of the content<br>
    //       <br>
    //       and 'removed' when at the minimum height.
    //       </div>
    //      </td>
    //     </tr>
    //    </tbody>
    //   </table>
    
    
    // All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts
    // These charactors are easily changed to charactors of choise using global find and replace.
    
    // The functional code(about 4K) is best as an external JavaScript
    
    // Tested with IE6 and Mozilla FireFox
    
    
    // Functional Code NO NEED to Change
    
    var zxcOOPCnt=0;
    
    
    function zxcCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv,zxcl){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.oopch){ zxcobj.level=zxcl||1; zxcobj.oopch=new zxcOOPCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv); }
     clearTimeout(zxcobj.oopch.to);
    
     zxcobj.oopch.dir=zxcdir;
     zxcobj.oopch.delay=zxcdly||zxcobj.oopch.delay;
     if (zxcdir>0){ zxcobj.style.display=''; }
     zxcobj.oopch.cngheight();
    }
    
    function zxcCngHeightToggle(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.cnghd){ zxcobj.cnghd=zxcdir; }
     else { zxcobj.cnghd*=-1; }
     zxcCngHeight(zxcobj,zxcobj.cnghd,zxcminh,zxcmaxh,zxcdly,zxcrmv);
    }
    
    function zxcFndHidden(zxcobj,zxcary){
     var zxcels=zxcobj.getElementsByTagName('*');
     for (var zxc0=0;zxc0<zxcels.length;zxc0++){
      if (zxcels[zxc0].style.overflow=='hidden'){
       zxcary.push(zxcels[zxc0]);
      }
     }
    }
    
    function zxcOOPCngHeight(zxcm,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv){
     this.ary=[];
     zxcFndHidden(zxcm,this.ary);
     this.objS=zxcm.style;
     if (!this.objS.position){ this.objS.position='relative'; }
     this.obj=zxcm;
     this.ext=['none']; // (T = top decrease with height, [1]- obj top)
     this.objS.overflow='hidden';
     this.ref='zxchs'+zxcOOPCnt;
     window[this.ref]=this;
     this.hlp=0;
     this.minh=zxcminh;
     this.maxh=zxcmaxh;
     if (this.minh<Math.abs(zxcdir)){ this.minh=Math.abs(zxcdir); }
     this.rmv=zxcrmv;
     this.dir=zxcdir;
     if (zxcdir<0){ this.cnt=this.maxh; }
     else { this.cnt=this.minh; }
     this.delay=zxcdly||100;
     this.to=null;
     zxcOOPCnt++;
    }
    
    zxcOOPCngHeight.prototype.cngheight=function(){
     if ((this.dir<0&&this.cnt+this.dir>this.minh)||(this.dir>0&&this.cnt+this.dir<this.maxh)){
      this.objS.height=(this.cnt+=this.dir)+'px';
      if (this.ext[0]=='T'){ this.objS.top=(this.ext[1]-parseInt(this.objS.height))+'px'; }
      this.chloop();
      this.setTimeOut("cngheight();",this.delay);
     }
     else if (this.dir<0){ this.objS.height=this.minh+'px'; if (this.rmv){ this.objS.display='none'; }; if (this.ext[0]=='T'){ this.objS.top=(this.ext[1])+'px'; }; }
     else if (this.dir>0){ this.objS.height=this.maxh+'px'; this.chloop(); }
    
    }
    
    zxcOOPCngHeight.prototype.chloop=function(){
     for (this.hlp=0;this.hlp<this.ary.length;this.hlp++){
      this.ary[this.hlp].style.height=this.objS.height;
     }
    }
    
    zxcOOPCngHeight.prototype.setTimeOut=function(zxcf,zxcd){
     this.to=setTimeout("window."+this.ref+"."+zxcf,zxcd);
    }
    
    
    function zxcCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv,zxcl){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.oopcw){  zxcobj.level=zxcl||1; zxcobj.oopcw=new zxcOOPCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv); }
     clearTimeout(zxcobj.oopcw.to);
     zxcobj.oopcw.dir=zxcdir;
     zxcobj.oopcw.delay=zxcdly||zxcobj.oopcw.delay;
     if (zxcdir>0){ zxcobj.style.display=''; }
     zxcobj.oopcw.cngwidth();
    }
    
    function zxcCngWidthToggle(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.cngwd){ zxcobj.cngwd=zxcdir; }
     else { zxcobj.cngwd*=-1; }
     zxcCngWidth(zxcobj,zxcobj.cngwd,zxcminw,zxcmaxw,zxcdly,zxcrmv);
    }
    
    function zxcOOPCngWidth(zxcm,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv){
     this.ary=[];
     zxcFndHidden(zxcm,this.ary);
     this.objS=zxcm.style;
     if (!this.objS.position){ this.objS.position='relative'; }
     this.obj=zxcm;
     this.ext=['none'];  // (L = left decrease with height, [1]- obj left)
     this.objS.overflow='hidden';
     this.ref='zxcws'+zxcOOPCnt;
     window[this.ref]=this;
     this.wlp=0;
     this.minw=zxcminw;
     this.maxw=zxcmaxw;
     if (this.minw<Math.abs(zxcdir)){ this.minw=Math.abs(zxcdir); }
     this.rmv=zxcrmv;
     this.dir=zxcdir;
     if (zxcdir<0){ this.cnt=this.maxw; }
     else { this.cnt=this.minw; }
     this.delay=zxcdly||100;
     this.to=null;
     zxcOOPCnt++;
    }
    
    zxcOOPCngWidth.prototype.cngwidth=function(){
     if ((this.dir<0&&this.cnt+this.dir>this.minw)||(this.dir>0&&this.cnt+this.dir<this.maxw)){
      this.objS.width=(this.cnt+=this.dir)+'px';
      if (this.ext[0]=='L'){ this.objS.left=(this.ext[1]-parseInt(this.objS.width))+'px'; }
      this.setTimeOut("cngwidth();",this.delay);
     }
     else if (this.dir<0){ this.objS.width=this.minw+'px'; if (this.rmv){ this.objS.display='none'; }; if (this.ext[0]=='L'){ this.objS.left=(this.ext[1])+'px'; }; }
     else if (this.dir>0){ this.objS.width=this.maxw+'px'; }
    }
    
    zxcOOPCngHeight.prototype.cwloop=function(){
     for (this.wlp=0;this.wlp<this.ary.length;this.wlp++){
      this.ary[this.wlp].style.width=this.objS.width;
     }
    }
    
    zxcOOPCngWidth.prototype.setTimeOut=function(zxcf,zxcd){
     this.to=setTimeout("window."+this.ref+"."+zxcf,zxcd);
    }
    
    
    //-->
    </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/

  • #6
    New to the CF scene
    Join Date
    Aug 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PERFECT!

    Thank you so much!

  • #7
    New to the CF scene
    Join Date
    Aug 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I actually have another question on this if you're still around. Here is what I'm currently using:

    Code:
    <a href="http://gcirm.cincinnati.com/RealMedia/ads/click_lx.ads/%%PAGE%%/%%RAND%%/%%POS%%/%%CAMP%%/%%IMAGE%%/%%USER%%"><img src="http://www.cincinnati.com/sponsors/enqpanel_910x40.jpg" border="0"></a><br>
    <div id="Test1" style="position:relative;overflow:hidden;width:910px;height:200px;background-color:white;" >
    <a href="http://gcirm.cincinnati.com/RealMedia/ads/click_lx.ads/%%PAGE%%/%%RAND%%/%%POS%%/%%CAMP%%/%%IMAGE%%/%%USER%%"><img src="http://www.cincinnati.com/sponsors/enqpanel_910x200.gif" width=910 height:200 border="0"></a>
    </div>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Change Width/Height Part 1 Application Notes and Functional Code
    // by Vic Phillips (21-Feb-2006) http://www.vicsjavascripts.org.uk
    
    
    // An elements width or height may be progressively changed or toggled
    // to a new specified dimension at specified increments at a specified speed.
    // The element may optionally removed (display:none;) when at the minimum dimension.
    
    // The script may be used for Multiple Level Menu and Rotate Image Cube applications.
    
    // There may be as many applications on a page as required.
    
    // Application Notes
    
    // The Code is in Three Parts
    
    // Part 1 - Application Notes and Functional Code
    // Part 2 - Multiple Level Menu applications.
    // Part 3 - Rotate Image Cube applications.
    
    // For Bespoke Application
    
    // To change the height: Executed by event call to zxcCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,true)
    // To toggle the height: Executed by event call to zxcCngHeightToggle(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,true)
    // To change the width:  Executed by event call to zxcCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,true)
    // To toggle the width:  Executed by event call to zxcCngWidthToggle(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,true)
    // where
    // parameter 0 = object or object ID name                                (object or string)
    // parameter 1 = the increment < 1 reduce height, > 1 increase height    (digits)
    // parameter 2 = the minimum height/height                               (digits)
    // parameter 3 = the maximum height/height                               (digits)
    // parameter 4 = (optional) delay (default 100mSec)                      (digits)
    // parameter 5 = (optional) true = remove element when at minimim height (true or null)
    
    // Note:
    //  Parameters 2,3 and 5 cannot be changed after the first element call
    //  The speed of execution is controlled by both parameter 1 and parameter 4
    
    // Table Applications
    // When applied to a table row the content of each <TD> must be nested in a <DIV>
    // with an inline style of position:relative;overflow:hidden;
    // e.g.
    //   <table>
    //    <tbody   >
    //     <tr >
    //      <td align="center"  onclick="zxcCngHeightToggle('Row2',1,20,130,5,true);" >
    //      <img src="http://www.vicsjavascripts.org.uk/StdImages/Up1.gif" ><img src="http://www.vicsjavascripts.org.uk/StdImages/Down1.gif" >
    //      </td>
    //     </tr>
    //     <tr height=100 id="Row2" style="display:none;" >
    //      <td align="left" valign="top">
    //      <div style="position:relative;overflow:hidden;top:0px;left:0px;width:100%;height:20px;text-align:center;" >
    //       <br>
    //       displayed with the 'toggle' event call from the TD above<br>
    //       <br>
    //        with progressive display of the content<br>
    //       <br>
    //       and 'removed' when at the minimum height.
    //       </div>
    //      </td>
    //     </tr>
    //    </tbody>
    //   </table>
    
    
    // All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts
    // These charactors are easily changed to charactors of choise using global find and replace.
    
    // The functional code(about 4K) is best as an external JavaScript
    
    // Tested with IE6 and Mozilla FireFox
    
    
    // Functional Code NO NEED to Change
    
    var zxcOOPCnt=0;
    
    
    function zxcCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv,zxcl){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.oopch){ zxcobj.level=zxcl||1; zxcobj.oopch=new zxcOOPCngHeight(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv); }
     clearTimeout(zxcobj.oopch.to);
    
     zxcobj.oopch.dir=zxcdir;
     zxcobj.oopch.delay=zxcdly||zxcobj.oopch.delay;
     if (zxcdir>0){ zxcobj.style.display=''; }
     zxcobj.oopch.cngheight();
    }
    
    function zxcCngHeightToggle(zxcobj,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.cnghd){ zxcobj.cnghd=zxcdir; }
     else { zxcobj.cnghd*=-1; }
     zxcCngHeight(zxcobj,zxcobj.cnghd,zxcminh,zxcmaxh,zxcdly,zxcrmv);
    }
    
    function zxcFndHidden(zxcobj,zxcary){
     var zxcels=zxcobj.getElementsByTagName('*');
     for (var zxc0=0;zxc0<zxcels.length;zxc0++){
      if (zxcels[zxc0].style.overflow=='hidden'){
       zxcary.push(zxcels[zxc0]);
      }
     }
    }
    
    function zxcOOPCngHeight(zxcm,zxcdir,zxcminh,zxcmaxh,zxcdly,zxcrmv){
     this.ary=[];
     zxcFndHidden(zxcm,this.ary);
     this.objS=zxcm.style;
     if (!this.objS.position){ this.objS.position='relative'; }
     this.obj=zxcm;
     this.ext=['none']; // (T = top decrease with height, [1]- obj top)
     this.objS.overflow='hidden';
     this.ref='zxchs'+zxcOOPCnt;
     window[this.ref]=this;
     this.hlp=0;
     this.minh=zxcminh;
     this.maxh=zxcmaxh;
     if (this.minh<Math.abs(zxcdir)){ this.minh=Math.abs(zxcdir); }
     this.rmv=zxcrmv;
     this.dir=zxcdir;
     if (zxcdir<0){ this.cnt=this.maxh; }
     else { this.cnt=this.minh; }
     this.delay=zxcdly||100;
     this.to=null;
     zxcOOPCnt++;
    }
    
    zxcOOPCngHeight.prototype.cngheight=function(){
     if ((this.dir<0&&this.cnt+this.dir>this.minh)||(this.dir>0&&this.cnt+this.dir<this.maxh)){
      this.objS.height=(this.cnt+=this.dir)+'px';
      if (this.ext[0]=='T'){ this.objS.top=(this.ext[1]-parseInt(this.objS.height))+'px'; }
      this.chloop();
      this.setTimeOut("cngheight();",this.delay);
     }
     else if (this.dir<0){ this.objS.height=this.minh+'px'; if (this.rmv){ this.objS.display='none'; }; if (this.ext[0]=='T'){ this.objS.top=(this.ext[1])+'px'; }; }
     else if (this.dir>0){ this.objS.height=this.maxh+'px'; this.chloop(); }
    
    }
    
    zxcOOPCngHeight.prototype.chloop=function(){
     for (this.hlp=0;this.hlp<this.ary.length;this.hlp++){
      this.ary[this.hlp].style.height=this.objS.height;
     }
    }
    
    zxcOOPCngHeight.prototype.setTimeOut=function(zxcf,zxcd){
     this.to=setTimeout("window."+this.ref+"."+zxcf,zxcd);
    }
    
    
    function zxcCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv,zxcl){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.oopcw){  zxcobj.level=zxcl||1; zxcobj.oopcw=new zxcOOPCngWidth(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv); }
     clearTimeout(zxcobj.oopcw.to);
     zxcobj.oopcw.dir=zxcdir;
     zxcobj.oopcw.delay=zxcdly||zxcobj.oopcw.delay;
     if (zxcdir>0){ zxcobj.style.display=''; }
     zxcobj.oopcw.cngwidth();
    }
    
    function zxcCngWidthToggle(zxcobj,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj);}
     if (!zxcobj.cngwd){ zxcobj.cngwd=zxcdir; }
     else { zxcobj.cngwd*=-1; }
     zxcCngWidth(zxcobj,zxcobj.cngwd,zxcminw,zxcmaxw,zxcdly,zxcrmv);
    }
    
    function zxcOOPCngWidth(zxcm,zxcdir,zxcminw,zxcmaxw,zxcdly,zxcrmv){
     this.ary=[];
     zxcFndHidden(zxcm,this.ary);
     this.objS=zxcm.style;
     if (!this.objS.position){ this.objS.position='relative'; }
     this.obj=zxcm;
     this.ext=['none'];  // (L = left decrease with height, [1]- obj left)
     this.objS.overflow='hidden';
     this.ref='zxcws'+zxcOOPCnt;
     window[this.ref]=this;
     this.wlp=0;
     this.minw=zxcminw;
     this.maxw=zxcmaxw;
     if (this.minw<Math.abs(zxcdir)){ this.minw=Math.abs(zxcdir); }
     this.rmv=zxcrmv;
     this.dir=zxcdir;
     if (zxcdir<0){ this.cnt=this.maxw; }
     else { this.cnt=this.minw; }
     this.delay=zxcdly||100;
     this.to=null;
     zxcOOPCnt++;
    }
    
    zxcOOPCngWidth.prototype.cngwidth=function(){
     if ((this.dir<0&&this.cnt+this.dir>this.minw)||(this.dir>0&&this.cnt+this.dir<this.maxw)){
      this.objS.width=(this.cnt+=this.dir)+'px';
      if (this.ext[0]=='L'){ this.objS.left=(this.ext[1]-parseInt(this.objS.width))+'px'; }
      this.setTimeOut("cngwidth();",this.delay);
     }
     else if (this.dir<0){ this.objS.width=this.minw+'px'; if (this.rmv){ this.objS.display='none'; }; if (this.ext[0]=='L'){ this.objS.left=(this.ext[1])+'px'; }; }
     else if (this.dir>0){ this.objS.width=this.maxw+'px'; }
    }
    
    zxcOOPCngHeight.prototype.cwloop=function(){
     for (this.wlp=0;this.wlp<this.ary.length;this.wlp++){
      this.ary[this.wlp].style.width=this.objS.width;
     }
    }
    
    zxcOOPCngWidth.prototype.setTimeOut=function(zxcf,zxcd){
     this.to=setTimeout("window."+this.ref+"."+zxcf,zxcd);
    }
    
    
    //-->
    </script>
    Is there a way to cookie it so a user only sees it expanded once?

    Thanks!

    Ace.

  • #8
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    if (!Cookie){ setTimeout('zxcCngHeight(\'Test1\',1,10,300,100,true);',1000); }

    where Cookie is the cookie value

    just put any value in the cookie

    many cookie scripts available

    one on

    http://www.vicsjavascripts.org.uk/Fo...Compendium.htm

    keyword cookie
    Code:
    .............
    <head>
      <title></title>
    </head>
    
    
    <body onload="Banner();" >
    
    
    <a href="http://gcirm.cincinnati.com/RealMedia/ads/click_lx.ads/%%PAGE%%/%%RAND%%/%%POS%%/%%CAMP%%/%%IMAGE%%/%%USER%%"><img src="http://www.cincinnati.com/sponsors/enqpanel_910x40.jpg" border="0"></a><br>
    <div id="Test1" style="position:relative;overflow:hidden;width:910px;height:10px;background-color:white;" >
    <a href="http://gcirm.cincinnati.com/RealMedia/ads/click_lx.ads/%%PAGE%%/%%RAND%%/%%POS%%/%%CAMP%%/%%IMAGE%%/%%USER%%"><img src="http://www.cincinnati.com/sponsors/enqpanel_910x200.gif" width=910 height:200 border="0"></a>
    </div>
    
    <script language="JavaScript" type="text/javascript">
    <!--
    // Form Compendium f19_Part2 (12-05-2005)
    // Form Cookie
    // by Vic Phillips http://www.vicsJavaScripts.org.uk
    
    // Customising Variables
    
    var f19_Days=1;       // The cookie will be available on revisits for a specified number of days
    var f19_Cookie='MyForm1';        // The Cookie name
    
    // Functional Code
    
    // No Need To Change ***************************
    var f19_TBAry=new Array();
    var f19_RCAry=new Array();
    var f19_TAAry=new Array();
    var f19_SLAry=new Array();
    
    var f19_TBString,f19_RCString,f19_TAString,f19_SLString;
    var f19_,f19_exp,f19_st,f19_len,f19_end,f19_st;
    
    var f19_Exp=new Date(new Date().getTime()+f19_Days*86400000).toGMTString();
    function Banner(){
    document.Show.Show2.value=f19_GetCookie(f19_Cookie);
     if (!f19_GetCookie(f19_Cookie)){
      setTimeout('zxcCngHeight(\'Test1\',1,10,300,100,true);',1000);
     }
     f19_SetFormCookie('FRED');
    }
    
    function f19_GetCookie(name) {
     var f19_st=document.cookie.indexOf(name+"=");
     var f19_len=f19_st+name.length+1;
     if ((!f19_st)&&(name != document.cookie.substring(0,name.length))) return null;
     if (f19_st==-1) return null;
     var f19_end=document.cookie.indexOf(";",f19_len);
     if (f19_end==-1) f19_end=document.cookie.length;
     return decodeURI(document.cookie.substring(f19_len,f19_end));
    }
    
    function f19_SetFormCookie(value){
    document.Show.Show0.value=vic;
     document.cookie=f19_Cookie+"="+encodeURI(f19_SLString)+";expires="+f19_Exp+";path=/;"
    }
    
    
    //-->
    </script>
    .................
    anyway this is a massive overkill, can simplify, if interested say
    Last edited by vwphillips; 05-31-2006 at 08:18 AM.
    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
    •