合成艺术字二 :使用的透明类以及所用的颜色选择器JS(完整事列源码)

1.透明类 ImageToTrans

using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Collections;


        public static Bitmap MakeTransparentGif(Bitmap bitmap, Color color)
        {
            byte R = color.R;
            byte G = color.G;
            byte B = color.B;
            MemoryStream fin = new MemoryStream();
            bitmap.Save(fin, System.Drawing.Imaging.ImageFormat.Gif);
            MemoryStream fout = new MemoryStream((int)fin.Length);
            int count = 0;
            byte[] buf = new byte[256];
            byte transparentIdx = 0;
            fin.Seek(0, SeekOrigin.Begin);
            //header   
            count = fin.Read(buf, 0, 13);
            if ((buf[0] != 71) || (buf[1] != 73) || (buf[2] != 70)) return null; //GIF   
            fout.Write(buf, 0, 13);
            int i = 0;
            if ((buf[10] & 0X80) > 0)
            {
                i = 1 << ((buf[10] & 7) + 1) == 256 ? 256 : 0;
            }
            for (; i != 0; i--)
            {
                fin.Read(buf, 0, 3);
                if ((buf[0] == R) && (buf[1] == G) && (buf[2] == B))
                {
                    transparentIdx = (byte)(256 - i);
                }
                fout.Write(buf, 0, 3);
            }
            bool gcePresent = false;
            while (true)
            {
                fin.Read(buf, 0, 1);
                fout.Write(buf, 0, 1);
                if (buf[0] != 0X21) break;
                fin.Read(buf, 0, 1);
                fout.Write(buf, 0, 1);
                gcePresent = (buf[0] == 0xf9);
                while (true)
                {
                    fin.Read(buf, 0, 1);
                    fout.Write(buf, 0, 1);
                    if (buf[0] == 0) break;
                    count = buf[0];
                    if (fin.Read(buf, 0, count) != count) return null;
                    if (gcePresent)
                    {
                        if (count == 4)
                        {
                            buf[0] = 0X01;
                            buf[3] = transparentIdx;
                        }
                    }
                    fout.Write(buf, 0, count);
                }
            }
            while (count > 0)
            {
                count = fin.Read(buf, 0, 1);
                fout.Write(buf, 0, 1);
            }
            fin.Close();
            fout.Flush();
            return new Bitmap(fout);
        } 

=================================================

2.所用JS1 veryide.color.js

 

/*
* Copyright VeryIDE,2007-2008
* http://www.veryide.com/

* $Id: veryide.color.js,v1.1 18:48 2008-11-19 leilei $
*/


/*
 οnfοcus="VeryIDE.Color(this)"
*/

VeryIDE.Color=function(o,i,s,f){
 

    VeryIDE.tmpColorA=o;
    VeryIDE.tmpColorB=arguments[1];
    VeryIDE.tmpColorF=f;
   
    //随机ID
    if(!VeryIDE.tmpID){
  VeryIDE.tmpID=getRnd(10);
    }
   
    var id=VeryIDE.tmpID;
   
    var color='';
    if(o.tagName=="IMG"){
  color=VeryIDE.tmpColorB.value;
    }else{
  color=o.value;
    }
   
    color?color:'#eeeeee';

 var active=['#fff','','#0A66EE','#EEEEEE'];
    o.οnkeyup=this;
   
    var pos=new getPosition(o);
   
    var obj=$(id);
    if(obj){
   delElement(id);
    }
   
 var obj=document.createElement("DIV");
  obj.id=id;
  
  with(obj.style){
   backgroundColor = "#f9f8f7";
   border = "solid #999999 1px";
   fontSize = "12px";
   position="absolute";
   top=pos.top+pos.height+"px";
   left=pos.left+"px";
  }

    var colorlist=["#000000","#000033","#000066","#000099","#0000cc","#0000ff","#003300","#003333","#003366","#003399","#0033cc","#0033ff","#006600","#006633","#006666","#006699","#0066cc","#0066ff","#009900","#009933","#009966","#009999","#0099cc","#0099ff","#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#00ff00","#00ff33","#00ff66","#00ff99","#00ffcc","#00ffff","#330000","#330033","#330066","#330099","#3300cc","#3300ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff","#336600","#336633","#336666","#336699","#3366cc","#3366ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff","#33cc00","#33cc33","#33cc66","#33cc99","#33cccc","#33ccff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff","#660000","#660033","#660066","#660099","#6600cc","#6600ff","#663300","#663333","#663366","#663399","#6633cc","#6633ff","#666600","#666633","#666666","#666699","#6666cc","#6666ff","#669900","#669933","#669966","#669999","#6699cc","#6699ff","#66cc00","#66cc33","#66cc66","#66cc99","#66cccc","#66ccff","#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#990000","#990033","#990066","#990099","#9900cc","#9900ff","#993300","#993333","#993366","#993399","#9933cc","#9933ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff","#999900","#999933","#999966","#999999","#9999cc","#9999ff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff","#99ff00","#99ff33","#99ff66","#99ff99","#99ffcc","#99ffff","#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#cc3300","#cc3333","#cc3366","#cc3399","#cc33cc","#cc33ff","#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#cc9900","#cc9933","#cc9966","#cc9999","#cc99cc","#cc99ff","#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ccff00","#ccff33","#ccff66","#ccff99","#ccffcc","#ccffff","#ff0000","#ff0033","#ff0066","#ff0099","#ff00cc","#ff00ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff","#ff6600","#ff6633","#ff6666","#ff6699","#ff66cc","#ff66ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff","#ffcc00","#ffcc33","#ffcc66","#ffcc99","#ffcccc","#ffccff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"];
   
 var ocbody;
 ocbody = '<table border="0" cellspacing="3" cellpadding="0" style="font-size:12px;cursor:default;line-height:20px;">';
   
    ocbody += "<tr height=\"20\"><td colspan=\"4\" bgcolor=\""+color+"\"><td><td colspan=\"3\" style=\"font-size:12px;\" align=\"center\">当前颜色</td>";
   
    ocbody += "<td colspan=\"2\"><td><td align=\"center\" height=\"20\" colspan=\"8\" onMouseOut=\"this.style.borderColor='"+active[0]+"';this.bgColor='"+active[1]+"';\" onMouseOver=\"this.style.borderColor='"+active[2]+"';this.bgColor='"+active[3]+"';\"  οnclick=\"window.open('http://www.i2up.com/lab/flash.color.php','_color');\" style=\"border:"+active[0]+" 1px solid;\">其它颜色</td>";
   
    ocbody += "<td colspan=\"2\"><td><td align=\"center\" colspan=\"2\" style='background:#666;color:#fff;' οnclick='VeryIDE.Color.close(\"color\");'>关闭</td></tr>";
   
  for(var i=0;i<colorlist.length;i++){
   if(i%24==0){
    ocbody += "<tr>";
   }
    ocbody += "<td width=\"16\" height=\"18\" style=\"border:"+active[0]+" 1px solid;\" onMouseOut=\"this.style.borderColor='"+active[0]+"';this.bgColor='"+active[1]+"';\" onMouseOver=\"this.style.borderColor='"+active[2]+"';this.bgColor='"+active[3]+"';\" onMouseDown=\"VeryIDE.Color.select('"+colorlist[i]+"','"+s+"')\" align=\"center\" valign=\"middle\"><table style=\"border:1px solid #808080;\" width=\"14\" height=\"14\" bgcolor=\""+colorlist[i]+"\"><tr><td></td></tr></table></td>";

   if(i%24==23){
    ocbody += "</tr>";
   }
  }
   
    ocbody += "</table>";

 obj.innerHTML=ocbody;
    document.body.appendChild(obj);
   
}

VeryIDE.Color.select=function(color,select){
    var o=VeryIDE.tmpColorA;
   
    if(typeof(VeryIDE.tmpColorF)=="function"){
  VeryIDE.tmpColorF(color);
    }
   
    if(select=="rgb"){
  var colorValue=VeryIDE.Color.rgb(color);
    }else{
  var colorValue=color;
    }
   
    if(o.tagName=="IMG"){
  o.style.backgroundColor=color;
  
  VeryIDE.tmpColorB.value=colorValue;
    }else{
  o.style.color=color;
  
  o.value=colorValue;
    }
 delElement(VeryIDE.tmpID);
}

VeryIDE.Color.close=function(){
    delElement(VeryIDE.tmpID);
}

VeryIDE.Color.rgb=function(hexColor){
 var a=hexColor;
 if(a.substr(0,1)=="#"){a=a.substring(1);}
 if(a.length!=6){return alert("请输入正确的颜色编码!");}
 a=a.toLowerCase()

 var b=new Array();
 for(x=0;x<3;x++){
  b[0]=a.substr(x*2,2)
  b[3]="0123456789abcdef";b[1]=b[0].substr(0,1)
  b[2]=b[0].substr(1,1)
  b[20+x]=b[3].indexOf(b[1])*16+b[3].indexOf(b[2])
 }
 return b[20]+","+b[21]+","+b[22];
}

VeryIDE.Color.hex=function(rgbColor){
 var hexcode="#";
 for(x=0;x<3;x++){
  var n=r1e[x].value;
  if(n==""){n="0";}
  
  if(parseInt(n)!=n){
   return alert("请输入数字!");
  }
  if(a<0 && a>255){
   return alert("数字在0-255之间!");
  }
  var c="0123456789abcdef";
  var b="";
  var a=n%16;b=c.substr(a,1)
  a=(n-a)/16;hexcode+=c.substr(a,1)+b
 }
 return hexcode;
}

/*state*/
VeryIDE.script["color"]=true;

============================================================

js  :veryide.core.js

==============================================================

 

/*
* Copyright VeryIDE,2007-2008
* http://www.veryide.com/

* $Id: veryide.core.js v1.2 19:47 2008-2-18 leilei $
*/

var VeryIDE={

 /*config*/
 site  :"VeryIDE",
 url   :"http://"+location.host+"/",
 domain :location.host,
 path  :"/veryide/",

 /*version*/
 version  :1.2,
 versionBuild : 20080904,
 
 /*developer*/
 developer   : "VeryIDE.Com",
 developerWeb : "http://www.veryide.com",

 /*event*/
 mouseX:0,
 mouseY:0,
 
 /*inti*/
 inti:null,
 layer:100,
 temp:"",
 
 /*script*/
 script:[],
 
 /*debug*/
 debug:false,
 
 /*info*/
 title:document.title,
 url:location.href,
 host:location.host,
 
 /*random*/
 rnd:Math.random(),
 getRnd:function(){
  return Math.random();
 },
 
 /*ui*/
 screenW:screen.width,
 screenH:screen.height,
 bodyW:document.documentElement.scrollWidth,
 bodyH:document.documentElement.scrollHeight,
 
 /*analytics*/
 referrer:document.referrer,
 isSearch:(/(baidu|yahoo|google|sogou|zhongsou|soso|youdao|tom|yisou|vnet|china|live|msn)\.(cn|com|net)/.test(document.referrer)),
 isIE   :false,
 isOpera  :false,
 isSafari  :false,
 isFirefox  :false,
 isMaxthon :false,
 appName:"",
 appVersion:"",
 appLang:"",

 /*load*/
 start:function(){
  /*powered*/
  VeryIDE.powered="Powered by <a href='http://www.veryide.com/?version="+VeryIDE.version+"&versionBuild="+VeryIDE.versionBuild+"&developer="+VeryIDE.developer+"&from="+location.host+"' title='VeryIDE' target='_blank'>VeryIDE</a> &amp; <a href='"+VeryIDE.developerWeb+"' title='"+VeryIDE.developerWeb+"' target='_blank'>"+VeryIDE.developer+"</a>",

 
  /*folder*/
  VeryIDE.folder={
   js    : VeryIDE.path+"js/",
   xml   :  VeryIDE.path+"xml/",
   skin  : VeryIDE.path+"skins/",
   icon  : VeryIDE.path+"images/icon/",
   cache  :  VeryIDE.path+"cache/",
   images : VeryIDE.path+"images/",
   plugins : VeryIDE.path+"plugins/"
  }

  /*browse*/
  switch (navigator.appName){
   case "Microsoft Internet Explorer":{
    VeryIDE.appName = "ie";
    var reg = /^.+MSIE (\d+\.\d+);.+$/;
    VeryIDE.isIE=true;
    
    if(navigator.userAgent.indexOf ("MAXTHON") != -1){
     VeryIDE.isMaxthon=true;
     var regMax = /^.+MAXTHON ([\d\.]+).{0,}$/;
     VeryIDE.maxVersion=navigator.userAgent.replace (regMax, "$1");
    }
    
    break;
   }default:{
    if (navigator.userAgent.indexOf ("Safari") != -1){
     VeryIDE.appName = "safari";
     var reg = /^.+Version\/([\d\.]+?) Safari.+$/;
     VeryIDE.isSafari=true;
    }else if (navigator.userAgent.indexOf ("Opera") != -1){
     VeryIDE.appName = "opera";
     var reg = /^.{0,}Opera\/(.+?) \(.+$/;
     VeryIDE.isOpera=true;
    }else{
     VeryIDE.appName = "firefox";
     var reg = /^.+Firefox\/([\d\.]+).{0,}$/;
     VeryIDE.isFirefox=true;
    }
   }
   break;
  }
     VeryIDE.appVersion = navigator.userAgent.replace (reg, "$1");
     
  if(!VeryIDE.isIE){
   var lang=navigator.language;
  }else{
   var lang=navigator.browserLanguage;
  }
  VeryIDE.appLang=lang.toLowerCase();
     
  /*bg cache*/
  if(VeryIDE.isIE && !VeryIDE.appVersion<7){
   try{
    //document.documentElement.addBehavior("#default#userdata");
    VeryIDE.getDocment().addBehavior("#default#userdata");
    document.execCommand("BackgroundImageCache", false, true);
   }catch(e){}
  }      
     
    },
   
 /*document*/
 getDocment:function(){
  var doc= (document.compatMode=="BackCompat"?document.body:document.documentElement);
  return doc;
 },
 
 /*script*/
 loadScript:function(name){
  if(VeryIDE.script[name]) return true;
 
  var root=document.getElementsByTagName("HEAD")[0];
  
  var script=document.createElement("script");
  script.type="text/javascript";
  script.src=VeryIDE.folder.js +"veryide."+ name+".js";
  root.appendChild(script);
 },
 
 showScript:function(){
  var str="";
  for(var key in VeryIDE.script){
   str+="veryide."+key+".js"+"\n";
  }
  alert(str);
 },
 
 showNavigator:function(){
  var str="";
  for(var key in navigator){
   str+= key+": "+navigator[key]+"\n";
  }
  alert(str);
 }, 
 
 /*event*/
 getMouse:function(e){
  if(!document.all){
   VeryIDE.mouseX = e.pageX;
   VeryIDE.mouseY = e.pageY;
  }else{
   VeryIDE.mouseX = e.x + VeryIDE.getDocment().scrollLeft;
   VeryIDE.mouseY = e.y + VeryIDE.getDocment().scrollTop;
  }
 },
 
 /*status*/
 setStatus:function(str){
  window.status=str;
 },
  
 /*message*/
 showMessage:function(str,fun){
  if (typeof fun != 'function') {
   alert(str.replace("<br />","\n\n"));
  }else{
   fun(str);
  }
 },

 /*test*/
 test:function(){
  // <input type="button" class="input-button" value="测 试" οnclick="VeryIDE.test();" />
  VeryIDE.showError("拖动框测试<br />拖动框测试<br />拖动框测试");
 }
 
}

VeryIDE.start();

/*state*/
VeryIDE.script["core"]=true;

===================================================

   js :veryide.library.js

===================================================

 

/*
* Copyright VeryIDE,2007-2008
* http://www.veryide.com/

* $Id: veryide.library.js,v2.3 17:29 2008-11-16 leilei $
*/


function $(obj){return document.getElementById(obj);}
function $N(obj){return document.getElementsByName(obj);}
function $T(obj){return document.getElementsByTagName(obj);}

function $V(str){document.write(str);}

//body load
function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
  window.onload = func;
 } else {
  window.onload = function() {
   oldonload();
   func();
  }
 }
}

//object event
function addObjectEvent(ele,evt,func){
 var oldonevent = ele['on'+evt];
 if (typeof ele['on'+evt] != 'function') {
  ele['on'+evt] = func;
 } else {
  ele['on'+evt] = function(event) {
   oldonevent(event);
   func(event);
  }
 }
}

//key event
function addKeyEvent(key,func){
 if(!VeryIDE.tmpKey){
  VeryIDE.tmpKey=[];
 }
 
 VeryIDE.tmpKey["k"+key]=func;
}

addKeyEvent.Listener=function(e,test){
 var event=e||window.event;
 if(VeryIDE.tmpKey["k"+event.keyCode]){
  VeryIDE.tmpKey["k"+event.keyCode](event);
 }
 if(test){
  alert(event.keyCode);
 }
}
//onkeydown判断charCode/keyCode

//获取对象
function getObject(o){
 if(typeof(o)!="object"){
  var o=$(o);
 }
 return o;
}

/*
String.prototype.trim = function(){
   return this.replace(/(^\s+)|\s+$/g,"");
}
*/

String.prototype.Trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function(){
    return this.replace(/(^\s*)/g, "");
}
String.prototype.Rtrim = function(){
    return this.replace(/(\s*$)/g, "");
}

//返回字符串字节数
String.prototype.long = function(){
 var i;
 var l = this.length;
 var len;
 len = 0;
 for (i=0;i<l;i++){
  if (this.charCodeAt(i)>255)
   len+=2;
  else
   len++;
 }
 return len;
}

//检查在数组内是否存在某值
function inArray(a,v) {
 var l = a.length;
 for(var i=0; i<=l; i++) {
  if(a[i]==v) return true;
 }
 return false;
}

//class为*的所有元素
document.getElementsByClassName = function() {
  var children = document.getElementsByTagName('*') || document.all;
  var elements = new Array();
  var len = children.length;

  for (var i = 0; i < len; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
     for (var k = 0; k < arguments.length; k++) { 
   if (classNames[j] == arguments[k]) {
          elements.push(child);
          break;
        }
      }
    }
  }
 
  return elements;
}

//ID以*开头的所有元素
document.getElementsByPrefix = function(prefix) {
  var children = document.getElementsByTagName('*') || document.all;
  var elements = new Array();
  var len = children.length;
 
  for (var i = 0; i < len; i++) {
    var child = children[i];
    var eid = child.id;
    if(eid&&eid.indexOf(prefix)>-1)
        elements.push(child);
  }
 
  return elements;
}

/*查找页面Meta*/    
function getMeta(name,att){
  metatags = document.getElementsByTagName("meta");
  for (cnt = 0; cnt < metatags.length; cnt++){                  
    if(metatags[cnt].getAttribute("name")==name){
      if(!att){
        return metatags[cnt];
      }else{
        return metatags[cnt].getAttribute(att);
      }
    }else{
      return null;
    }
  }
}

//加载新脚本
function loadScript(src,target){
 if(!target){
  var root=$T("HEAD")[0];
 }else{
  var root=getObject(target);
 }
 
 var script=document.createElement("script");
 script.type="text/javascript";
 script.src=src;
 
 var code=arguments[2];
 if(code){
  script.charset=code;
 }
 
 root.appendChild(script);
}

//取得文件名
function getFileName(url){
 var strUrl=location.href;
 if(url){
  strUrl=url;
 }
 var arrUrl=strUrl.split("/");
 var strPage=arrUrl[arrUrl.length-1];
 return strPage;
}

//对象绝对位置
function getPosition(obj){ 
 var obj=getObject(obj);

 this.width=obj.offsetWidth;
 this.height=obj.offsetHeight; 
 this.top=obj.offsetTop; 
 this.left=obj.offsetLeft; 
 while(obj=obj.offsetParent){ 
  this.top+=obj.offsetTop; 
  this.left+=obj.offsetLeft;
 }
}

function getSelect(obj){
 var obj=getObject(obj);
 
 this.value="";
 this.text="";
 this.index="";
 
 if(obj.length>0){
  this.value=obj[obj.selectedIndex].value;
  this.text=obj[obj.selectedIndex].text;
  this.index=obj.selectedIndex;
 }
 this.getAtt=function(att){
  return obj[obj.selectedIndex].getAttribute(att);
 }
}

//
function getRadio(obj){
 var obj=$N(obj);
 var len = obj.length;
 
 this.value="";
 for(var i=0;i<len;i++){
  if(obj[i].checked==true){
   this.value=obj[i].value;
   break;
  }
 }
}

 

//对象显示隐藏
function showHide(obj){
 var obj=getObject(obj);
 if(obj){
  if(obj.offsetHeight==0||obj.style.display== "none") {obj.style.display = "block";}else{obj.style.display = "none";}
 }
}

function setCheckBox(obj,v){
 var obj=$N(obj);

 if(obj[0]){
  var len = obj.length;
  for(var i=0;i<len;i++){
   if(obj[i].value==v){
    obj[i].checked=true;
   }else{
    obj[i].checked=false;
   }
  }
 }else{
  obj=$(obj);
  if(obj.value==v){
   obj.checked=true;
  }else{
   obj[i].checked=false;
  }
 }
}

//选择列表项
function setSelect(obj,v){
 var obj=$(obj);
 var len = obj.length;
 for(var i=0;i<len;i++){
  if(obj[i].value == v){
   obj.selectedIndex=i;
   break;
  }
 }
}

//选择单选项
function setRadio(o,v){  
 var obj=$N(o);
 var len = obj.length;
 for(var i=0;i<len;i++){
  if(obj[i].value == v){
   obj[i].checked=true;
   break;
  }
 }
}

//禁用对象
function setDisabled(obj,b){ 
 var obj=getObject(obj);
 if (obj){obj.disabled=b;}
}

function setClass(obj,Class,Type){
 var obj=getObject(obj);
 if(obj){
  switch(Type){
   case "+":
    obj.className+=" "+Class;
   break;
   
   case "-":
    obj.className=obj.className.replace(Class,"");
   break;
   
   case "":
    obj.className=Class;
   break;
   
  }
 }
}

//新建连续下接列表项
function newNumOption(obj,s,e,t){
 var obj=getObject(obj);
 if(t=="new"){obj.length=0;}
 for(var i=s;i<(e+1);i++){
  obj.options[obj.length] = new Option(i,i);
 }
}

//删除对象
function delElement(obj){
 var obj=getObject(obj);
 var p=obj.parentNode;
 p.removeChild(obj);
}

//确认操作
function getConfirm(info){
 if(!confirm(info)){return false}
}

//新窗口打开链接
//rel="_blank"
function _blank(){
 var anchors = document.getElementsByTagName("A");
 var len = anchors.length;
 for (var i=0; i<len; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "_blank"){
   anchor.target = "_blank";
  }
 }
}

//获取URL参数
function getQuery(n,url){
 if(!url){
  var url=location.href;
 }
 
 var v = '';
 var o = url.indexOf(n+"=");
 if (o != -1){
  o += n.length + 1 ;
  e = url.indexOf("&", o);
  if (e == -1){
   e = url.length;
  }
  v = unescape(url.substring(o, e));
 }
 
 //seo
 if(!v){
  var o = url.indexOf(n+"-");
  if (o != -1){
   o += n.length + 1 ;
   e = url.indexOf("-", o);
   if (e == -1){
    e = url.length;
   }
   v = unescape(url.substring(o, e));
  }
 }
 
 return v;
}

//全角转半角
function switchChar(str){
 var str1="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 var str2="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 var len=str.length;
 for(var i=0; i<len; i++){
  var n = str2.indexOf(str.charAt(i));
  if(n != -1) str = str.replace(str.charAt(i), str1.charAt(n));
 }
 return str;
}

/*
 获取随机字符
 ***********
 len  长度
 vUpper 是否大写字母
 vLower 是否小写字母
 vNum  是否数字
*/
function getRnd(len,vUpper,vLower,vNum){
 var seed_array=new Array();
 var seedary;

 seed_array[0]=""
 seed_array[1]= "a b c d e f g h i j k l m n o p q r s t u v w x y z";
 seed_array[2]= "a b c d e f g h i j k l m n o p q r s t u v w x y z";
 seed_array[3]= "0 1 2 3 4 5 6 7 8 9";

 if (!vUpper&&!vLower&&!vNum){vUpper=true;vLower=true;vNum=true;}

 if (vUpper){seed_array[0]+=seed_array[1];}
 if (vLower){seed_array[0]+=" "+seed_array[2];}
 if (vNum){seed_array[0]+=" "+seed_array[3];}

 seed_array[0]= seed_array[0].split(" ");
 seedary="";
 
 for (var i=0;i<len;i++){
  seedary+=seed_array[0][Math.round(Math.random()*(seed_array[0].length-1))]
 }
 return(seedary);
}


/*
 获取cookies
 name cookie名称
 sub  子cookie名称
*/
function getCookie(name,sub){
 var str="";
 var arr = document.cookie.replace(/%25/g,"%").replace(/%5F/g,"_").match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
 if(arr !=null){
  try{
   str=decodeURIComponent(arr[2]);
  }catch(e){
   str=arr[2];
  }
 }
 
 if(sub){
  if(str){
   var nSubValueBegin = str.indexOf(sub+"=");
  }else{
   var nSubValueBegin =-1
  }
  
  if(nSubValueBegin != -1){
   var nSubValueEnd = str.indexOf("&", nSubValueBegin);
   if(nSubValueEnd == -1)
   nSubValueEnd = str.length;
   var sSubValue = str.substring(nSubValueBegin + sub.length+1, nSubValueEnd);//获得指定的子键值
   str=sSubValue;
  }else{
   str="";
  }
 }
 return str;
}

function setCookie(key,value,iExpireDays,domain){
 var cookies=key.replace("_","%5F") + "=" + encodeURIComponent(value)+ "; ";
 
 if (iExpireDays){
  var dExpire = new Date();
  dExpire.setTime(dExpire.getTime()+parseInt(iExpireDays*24*60*60*1000));
  cookies += "expires=" + dExpire.toGMTString()+ "; ";
 }
 
 if(domain){
  cookies += "domain="+domain+"; ";
 }
 cookies += "path=/;";
 document.cookie = cookies;
}

/*state*/
VeryIDE.script["library"]=true;

=================================================

以上完全可以合成艺术字,下载地址: http://www.100disk.net/pick.aspx?code=1846447509

转载于:https://www.cnblogs.com/ggbbeyou/archive/2008/12/17/1356879.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/496541.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

推荐!神经进化才是深度学习未来的发展之路!

来源&#xff1a;全球人工智能过去几年时间里&#xff0c;我们有一个完整的团队致力于人工智能研究和实验。该团队专注于开发新的进化计算方法&#xff08;EC&#xff09;&#xff0c;包括设计人工神经网络架构、构建商业应用程序&#xff0c;以及使用由自然进化激发的方法来解…

mysql max字符串数值_针对字符串值的mysql:min()和max()。

我有一个连接两个表的SQL Select语句。主表包含产品的其他信息,并联接到第二个尺寸表。第二个表包含存储为字符串的非数字大小列表,其结构简单如下…sizeID主键sizename字符串大小值(即,小、中、大)size order用于排序大小顺序的整数值(即,size order为5表示大小大于size order…

linux 命令:ping、fping、gping、hping3、tracert、traceroute

From&#xff1a; Nmap、Netcat、Hping3工具对比&#xff1a;http://www.2cto.com/article/201210/158961.html ​hping3 命令&#xff1a;http://man.linuxde.net/hping3 示例&#xff1a;Testing firewall rules with Hping3 &#xff1a;https://www.docin.com/p-74538211…

Java加密与解密的艺术~数字签名~模型分析

甲方作为消息的发送方&#xff0c;乙方作为消息的接收方。假设甲乙双方在消息传递之前已经指定了要使的数字签名算法&#xff08;如RSA算法&#xff09;。为完成签名验证&#xff0c;甲乙双方需要以下操作&#xff1a; 1&#xff09;、由消息发送方&#xff08;甲方&#xff09…

BlazeDS入门教程-很详细-赞原创作者一个

什么是BlazeDS呢&#xff1f;BlazeDS是一个基于服务器的Java远程调用&#xff08;remoting&#xff09;和Web消息传递&#xff08;messaging&#xff09;技术&#xff0c;它能够使得后台的Java应用程序和运行在浏览器上的Flex应用程序相互通信。在各大搜索引擎里&#xff0c;关…

excel概率密度函数公式_标准正态分布密度函数公式

展开全部标准正态分布密度函数公式&#xff1a;正态曲线呈钟型62616964757a686964616fe58685e5aeb931333366306532&#xff0c;两头低&#xff0c;中间高&#xff0c;左右对称因其曲线呈钟形&#xff0c;因此人们又经常称之为钟形曲线。若随机变量X服从一个数学期望为μ、方差为…

2017-2018中国物联网产业全景图谱报告——物联网对产业深度变革已开启

来源&#xff1a;物联网智库丨公众号如果说2016年里物联网的产业生态各种要素已具备&#xff0c;那么2017年就是物联网对于国民经济产业变革的规模效应初显的一年&#xff0c;可以说是物联网对产业变革的元年。在这一过程中&#xff0c;通过二维生态图谱去了解过去一年的进展不…

linux命令终极系列awk

AWK man 手册&#xff1a;http://man.linuxde.net/awk AWK编程的内容极多&#xff0c;这里只罗列简单常用的用法&#xff0c;更多请参考 http://www.gnu.org/software/gawk/manual/gawk.html 简介 什么是awk? awk是一个强大的文本分析工具&#xff0c;相对于grep的查找&a…

Java加密与解密的艺术~数字签名~RSA实现

RSA 实现 /*** 2008-6-11*/ package org.zlex.chapter09_1;import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.PublicKey; import …

图灵2008年12月出版的计算机图书

《JavaScript设计模式》 《MySQL必知必会》 《实用Java教程&#xff1a;基于BlueJ的对象优先方法(第3版)》 《C#图解教程》 转载于:https://www.cnblogs.com/bookshop/archive/2008/12/21/1359397.html

mysql numeric float_sql 下,float和numeric

搜了下两者的区别&#xff0c;答案其实很明显:numeric支持最长38位长度的数字&#xff0c;只有在你要的数字的长度超过38位时才推荐使用float原因是&#xff0c;float在保存和提取&#xff0c;以及数学计算等方面&#xff0c;会产生于期待记过不一致的情况。为什么呢&#xff1…

科技部认定的独角兽名单来了!共164家

来源&#xff1a;中国证券报丨公众号 作者&#xff1a;杨洁今天上午&#xff0c; 科技部火炬中心、中关村管委会、长城战略咨询、中关村银行联合主办“2017中国独角兽企业发展报告”发布会。《2017中国独角兽企业发展报告》显示&#xff1a; 2017年中国独角兽企业共164家新晋62…

p0f - 被动探测操作系统工具

参考&#xff1a;http://lcamtuf.coredump.cx/p0f3/ p0f是一款被动探测工具&#xff0c;能够通过捕获并分析目标主机发出的数据包来对主机上的操作系统进行鉴别&#xff0c;即使是在系统上装有性能良好的防火墙的情况下也没有问题。。目前最新版本为3.09b。同时p0f在网络分析方…

《Head First 设计模式》专题上线

立即访问《Head First 设计模式》专题 我们为这本经典图书制作了专题&#xff0c;也想在此了解一下园子里有哪些朋友看过这本书。 --- 博客园团队 2008年12月26日 转载于:https://www.cnblogs.com/bookshop/archive/2008/12/26/1363084.html

Java加密与解密的艺术~数字签名~DSA实现

DSA 实现 /*** 2008-6-13*/ package org.zlex.chapter09_2;import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.PublicKey; import …

mysql临时表和永久表_SQL临时表和永久表

drop table #Tmp --删除临时表#Tmpcreate table #Tmp --创建临时表#Tmp(ID int IDENTITY (1,1) not null, --创建列ID,并且每次新增一条记录就会加1WokNo varchar(50),primary key (ID) --定义ID为临时表#Tmp的主键);Select * from #Tmp --查询…

tcpdump - 数据包进行截获的包分析工具

From&#xff1a;http://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html 30 分钟掌握 tcpdump&#xff1a;http://zhuanlan.51cto.com/art/201701/527498.htm Android tcpdump 下载&#xff1a;https://www.androidtcpdump.com/android-tcpdump/downloads tcpdum…

相持不下的争论:脑波,有用吗?

来源&#xff1a;原理、编译&#xff1a;糖兽在大脑中&#xff0c;存在着我们看不见的脑电活动。这些脑波是由在大脑周围大量存在神经细胞的协调发射而产生的&#xff0c;他们可以从大脑的前部传到后部&#xff0c;从大脑深处传到头皮。这种脑电活动被称为神经元振荡。有意思的…

CVS 客户端使用手册

IRLab 2003年2月10日 什么是CVS CVS&#xff08;Version Control System.&#xff09;即版本控制系统。用来记录源文件的历史信息。甚至二进制文件&#xff0c;媒体文件等。 例如&#xff0c;当软件修改时有时会产生Bugs&#xff0c;并且你可能在做这次修改后很长时间不会发现这…

redisserver是什么问题_面试官老是问:为什么采用单线程的Redis也会如此之快?...

Java面试笔试面经、Java技术每天学习一点公众号Java面试关注我不迷路作者&#xff1a;kaito来源&#xff1a;http://kaito-kidd.com/2020/06/28/why-redis-so-fast/众所周知&#xff0c;Redis在内存库数据库领域非常地火热&#xff0c;它极高的性能和丰富的数据结构为我们的开发…