»
AnglaisFrançaisVietnamien

Imprimer - Cell Change BG - JavaScriptBank.com

Version complète: jsB@nk » Arrière-plan » Fading fond » Cell Change BG
URL: https://www.javascriptbank.com/cell-bg-changer.html

Cell Change BG © JavaScriptBank.comUtilisez ce script DHTML pour rendre certains éléments de formulaire flash avec allégresse. C'est une excellente façon d'attirer l'attention sur des domaines importants, tels que le bouton de soumission, etc

Version complète: jsB@nk » Arrière-plan » Fading fond » Cell Change BG
URL: https://www.javascriptbank.com/cell-bg-changer.html



JavaScript
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*//* * File         :   ccbg.js * Description  :   A JavaScript visual effect that changes objects' background color continuously. *                   * Usage        :   startccbg("id") *                  stopccbg("id") * * Copyright (C) 2002  Isaac TC Chau (isaac@isaacchau.com) *  * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. *  * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. *  * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA  02111-1307, USA. * */function toHex(n){    var Hex     =   new Array( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "E", "E", "F" );    var dec     =   parseInt(n, 10);    var hexstr  =   Hex[(dec & 0xF0)>>>4] + Hex[(dec & 0xF)];    return hexstr;}// End toHex()var ccarr   =   new Array();var handle  =   null;var timeout =   75;             // time in millisecond of refresh ratevar step    =   Math.PI / 180.; var rmax    =   255;var gmax    =   255;var bmax    =   255;var kr      =   1.1;var kg      =   1.9;var kb      =   1.5;function ccobj(id){    this.id     =   id;    this.obj    =   document.getElementById(this.id);    this.x      =   0;    this.handle =   null;}// End ccobj()function startccbg(id){    if ( document.getElementById(id) ){        var idx             =   ccarr.length;        ccarr[idx]          =   new ccobj(id);        ccarr[idx].enable   =   true;    }    if ( handle == null ){        handle = window.setInterval(ccbg, timeout);    }}// End startccbg()function stopccbg(id){    for (var i=0; i<ccarr.length; i++){        if ( ccarr[i] ){            if ( ccarr[i].id == id ){                ccarr[i] = null;                break;            }        }    }}// End stopccbg()function ccbg(){    for (var id=0; id < ccarr.length; id++){        if ( ccarr[id] ){            var r           =   toHex(rmax * ((Math.sin( kr * ccarr[id].x ) + 1)/2));            var g           =   toHex(gmax * ((Math.sin( kg * ccarr[id].x ) + 1)/2));            var b           =   toHex(bmax * ((Math.sin( kb * ccarr[id].x ) + 1)/2));            ccarr[id].obj.style.backgroundColor     =   "#" + r + g + b;            ccarr[id].x     =   ccarr[id].x + step;        }    }}// End ccbg()</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM><DIV id=div1 align=center><INPUT onclick="startccbg('tbl1')" type=button value=start> <INPUT onclick="stopccbg('tbl1')" type=button value=stop> </DIV></FORM><SCRIPT>startccbg("div1");</SCRIPT><table border="1" width="100%" id="table1"><tr><td><INPUT onclick="startccbg('tbl1')" type=button value=start> <INPUT onclick="stopccbg('tbl1')" type=button value=stop></td></tr></table><SCRIPT>startccbg("table1");</SCRIPT><form><p><input type="text" name="T1" size="20" id=text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" value="V1" checked name="R1"></p><SCRIPT>startccbg("text");startccbg("R1");    </SCRIPT></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->