Login   Register  
PHP Classes
elePHPant
Icontem

File: js/fn_buildcolortable.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Francisco Caserio  >  cls_form  >  js/fn_buildcolortable.js  >  Download  
File: js/fn_buildcolortable.js
Role: Auxiliary script
Content type: text/plain
Description: color table object (color type field)
Class: cls_form
Generate Web pages to manipulate database records
Author: By
Last change:
Date: 2008-10-31 04:48
Size: 1,680 bytes
 

Contents

Class file image Download
function fn_BuildColorTable(id,varbgColor) {
    var typeList = new Array()
    typeList[id] = new Array("eval('window.varbgColor=event.srcElement.bgColor');eval('document.all.samplebgColor.style.backgroundColor=event.srcElement.bgColor');eval('document.all.cor.value=event.srcElement.bgColor.substring(1,7)')")
    var htmlstr, cPick = new Array("00","33","66","99","CC","FF"), fnColor = ""
    htmlstr = ""
    + "<TABLE STYLE=\"margin: 10px;\" CELLSPACING=0 CELLPADDING=0><TR><TD width=50 ALIGN=center VALIGN=middle>"
    + "<DIV STYLE=\"width:20px; height:20px; border:1px black solid; border-Bottom:0px; background-color: " + varbgColor + "\" ID=\"samplebgColor\"></DIV>"
    + "<DIV STYLE=\"width:20px; height:20px; border:1px black solid; background-color: white\" ID=\"sampleCurrentColor" + id + "\"></DIV>"
    + "</TD><TD>"
    + "<TABLE ONMOUSEOUT=\"document.all.sampleCurrentColor" + id + ".style.backgroundColor = 'white'\" ONMOUSEOVER=\"document.all.sampleCurrentColor" + id + ".style.backgroundColor = event.srcElement.bgColor\" STYLE=\"border:1px black solid; cursor:hand\" CELLSPACING=0 CELLPADDING=0 ID=\"sampleColor\">"
    for (var r=0;r<cPick.length;r++) {
        htmlstr+="<TR STYLE=\"height:20\">"
        for (var g=cPick.length-1;g>=0;g--) {
            for (var b=cPick.length-1;b>=0;b--) {
                fnColor = cPick[r]+cPick[g]+cPick[b] 
                htmlstr+="<TD STYLE=\"width:5\""
                + " BGCOLOR=\"#" + fnColor + "\""
                + " TITLE=\"#" + fnColor + "\" "
                + " ONCLICK=\"" + typeList[id][0] + "\""
                + "></TD>"
            } 
        }
        htmlstr+="</TR>"
    }
    htmlstr+="</TABLE></TD></TR></TABLE>"
    htmlstr+="<input type=hidden value=" + varbgColor + " name=" + id + ">"
    document.write(htmlstr)
}