加载中…
个人资料
csbeyond
csbeyond
  • 博客等级:
  • 博客积分:0
  • 博客访问:13,395
  • 关注人气:125
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

打造自己的彩字渐变自动在线生成器 (新浪首发) by:csbeyond 转载请注明

(2006-08-08 07:36:46)
分类: *原创文章* -多多支持-

BY: CSBEYOND

看到下面的彩字了么~

ubbhtml使

还可以试试看这个

 

""下面是彩字代码大家只要把标志性的文字和链接卷掉就可以了

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0027)http://goddistance.a.lunqun.com/cs.htm -->
<HTML><HEAD><TITLE>『csbeyond's blog』blog bbs 变色贴彩字转换工具</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>.style1 {
 COLOR: #ffffff
}
.style3 {
 FONT-WEIGHT: bold; COLOR: #ffffff
}
.small_font {
 FONT-SIZE: 9pt
}
BODY {
 FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial; BACKGROUND-COLOR: #666666
}
A:active {
 FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial
}
A:link {
 FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Arial
}
A:visited {
 FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Arial
}
LI {
 FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial
}
OL {
 FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial
}
TABLE {
 FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial
}
TD {
 FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial
}
BODY {
 COLOR: #333333
}
TD {
 COLOR: #333333
}
TH {
 COLOR: #333333
}
</STYLE>

<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
 function pick_color(obj){
 document.form1.cur_color.value=obj;
 var MouseX=event.x;
 var MouseY=event.y;
 Layer1.style.left=MouseX;
 Layer1.style.top=MouseY;
 MM_showHideLayers('Layer1','','show')
 }

 function set_color(szColor){
 obj=document.form1.cur_color.value;
 if(obj=='s'){
  document.form1.start_color.value=szColor;
  document.all.td_start.bgColor='#'+szColor;
 }else{
  document.form1.end_color.value=szColor;
  document.all.td_end.bgColor='#'+szColor;
 }
 MM_showHideLayers('Layer1','','hide')
 }

function pv(){ //preview
 if(!document.form1.text1.value){
  alert('没有文字可以转换!');
  document.form1.text1.focus();
 }else{
  document.all.preview.innerHTML=generate('html',document.form1.text1.value);
 }
}

function gen_onclick(){
 if(document.form1.format[0].status==true){
  document.form1.text2.value=generate('ubb',document.form1.text1.value);
 }else{
  document.form1.text2.value=generate('html',document.form1.text1.value);
  
 }
}

function generate(action,str){
 scolor=document.form1.start_color.value;
 ecolor=document.form1.end_color.value;
 r1=HexToNum(scolor.substring(0,2));
 g1=HexToNum(scolor.substring(2,4));
 b1=HexToNum(scolor.substring(4,6));
 r2=HexToNum(ecolor.substring(0,2));
 g2=HexToNum(ecolor.substring(2,4));
 b2=HexToNum(ecolor.substring(4,6));
 r_step=(r1-r2-((r1-r2)%str.length))/str.length;
 g_step=(g1-g2-((g1-g2)%str.length))/str.length;
 b_step=(b1-b2-((b1-b2)%str.length))/str.length;
 if(r_step==0){r_step=3;}
 if(g_step==0){g_step=3;}
 if(b_step==0){b_step=3;}
 var str2='';
 r_color=r1;
 g_color=g1;
 b_color=b1;
 for(var i=0;i<str.length;i++){
  cur_str=str.substring(i,i+1);
  r_color=r_color-r_step;
  g_color=g_color-g_step;
  b_color=b_color-b_step;
  if(r_color>=255||r_color<0){r_color=r1;}
  if(g_color>=255||g_color<0){g_color=g1;}
  if(b_color>=255||b_color<0){b_color=b1;}
  cur_color=NumToHex(r_color)+''+NumToHex(g_color)+''+NumToHex(b_color)
  if(action=='html'){
   if(cur_str=='\n'){
    str2+='<br>';
   }else{
    str2+='<font color=#' +cur_color+ '>' + cur_str + '</font>';
   }
  }else{
   str2+='[color=#' +cur_color+ ']'+cur_str+'[/color]';
  
 }
 return str2;
}

function reset_form(){
 document.form1.reset();
 document.all.td_start.bgColor='#'+document.form1.start_color.value;
 document.all.td_end.bgColor='#'+document.form1.end_color.value;
 document.all.preview.innerHTML='';
}

function about(){
 var about='<font color=blue><center><b>csbeyond</b><br><br><a href=http://blog.sina.com.cn/m/csbeyond target=_blank>http://blog.sina.com.cn/m/csbeyond</a><br><br>csbeyond</center></font>';
 document.all.preview.innerHTML=about;

}

function copy_to_cb() {
 if(document.form1.text2.value){
  document.form1.text2.focus();
  document.form1.text2.select();
  therange=document.form1.text2.createTextRange();
  therange.execCommand("Copy");
  alert("代码已经拷贝到你的剪贴板上了!\n\n请按Ctrl+V将其粘贴到适当的位置。");
 }
}


function MakeNum(str) {
 if((str >= 0) && (str <= 9)){
  return str;
 }
 switch(str.toUpperCase()) {
 case "A": return 10;
 case "B": return 11;
 case "C": return 12;
 case "D": return 13;
 case "E": return 14;
 case "F": return 15;
 }
}

function HexToNum(hex) {
 tens = MakeNum(hex.substring(0,1));
 ones = 0;
 ones=MakeNum(hex.substring(1,2));
 num = (tens * 16) + (ones * 1);
 return num;
}

function NumToHex(strNum) {
 var base,rem,baseS,remS;
 base = strNum / 16;
 rem = strNum % 16;
 base = base - (rem / 16);
 baseS = MakeHex(base);
 remS = MakeHex(rem);
 hex = baseS + '' + remS;
 return hex;
}

function MakeHex(x) {
 if((x >= 0) && (x <= 9)){
  return x;
 }else{
  switch(x) {
  case 10: return "A";
  case 11: return "B"; 
  case 12: return "C"; 
  case 13: return "D"; 
  case 14: return "E"; 
  case 15: return "F"; 
    }
 }
}


function MM_callJS(jsStr) { //v2.0
  return eval_r(jsStr)
}
//-->
</SCRIPT>

<META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD>
<BODY>
<FORM name=form1 action="" method=post>
<TABLE cellSpacing=0 cellPadding=3 width=760 align=center border=0>
  <TBODY>
  <TR bgColor=#ff9900>
    <TD bgColor=#000000>
      <DIV class=style1 align=center><STRONG>待转换文字</STRONG></DIV></TD>
    <TD bgColor=#000000>
      <DIV class=style1 align=center><STRONG>转换结果</STRONG></DIV></TD></TR>
  <TR bgColor=#e3e3e3>
    <TD>
      <DIV align=center><TEXTAREA id=text1 name=text1 rows=6 wrap=VIRTUAL cols=48>这是一个可以自动生成变色文字的小工具,生成的变色文字可以在支持ubb或者html的论坛上使用,让你的文字更加吸引。</TEXTAREA>
      </DIV></TD>
    <TD>
      <DIV align=center><TEXTAREA id=text2 ondblclick=copy_to_cb() onmouseover=this.select() name=text2 rows=6 readOnly wrap=VIRTUAL cols=48></TEXTAREA>
      </DIV></TD></TR>
  <TR bgColor=#000000>
    <TD colSpan=2>
      <DIV align=center><SPAN class=style3>转换选项</SPAN> </DIV></TD></TR>
  <TR bgColor=#e3e3e3>
    <TD>
      <DIV align=center>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD>
            <DIV align=right>起始颜色:# <INPUT id=start_color readOnly size=8
            value=FF0000 name=start_color> </DIV></TD>
          <TD>
            <TABLE height=10 cellSpacing=0 cellPadding=0 width=10 border=0>
              <TBODY>
              <TR>
                <TD id=td_start style="CURSOR: hand" onclick="pick_color('s')"
                bgColor=#ff0000>&nbsp;</TD></TR></TBODY></TABLE></TD>
          <TD>
            <DIV align=right>终止颜色:# <INPUT id=end_color readOnly size=8
            value=0000FF name=end_color> </DIV></TD>
          <TD>
            <TABLE height=10 cellSpacing=0 cellPadding=0 width=10 border=0>
              <TBODY>
              <TR>
                <TD id=td_end style="CURSOR: hand" onclick="pick_color('e')"
                bgColor=#0000ff>&nbsp;</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
    <TD>
      <DIV align=center><INPUT type=radio CHECKED value=ubb name=format>
      转换成UBB代码 <INPUT type=radio value=html name=format> 转换成HTML代码</DIV></TD></TR>
  <TR bgColor=#333333>
    <TD colSpan=2>
      <DIV align=center><INPUT id=cur_color type=hidden name=cur_color> <INPUT onclick="MM_callJS('pv()')" type=button value=" - = 预览 = - " name=Button>
<INPUT onclick="MM_callJS('gen_onclick()')" type=button value=" - = 生成 = - " name=Button2>
<INPUT onclick="MM_callJS('reset_form()')" type=button value=" - = 重来 = -" name=Reset_bt>
<INPUT id=about onclick="MM_callJS('about()')" type=button value=" - = 关于 = -" name=about>
      </DIV></TD></TR>
  <TR bgColor=#333333>
    <TD colSpan=2 height=5>
      <DIV id=preview></DIV></TD></TR></TBODY></TABLE></FORM>
<HR SIZE=1>

<DIV class=style1 align=center><A href="http://blog.sina.com.cn/m/csbeyond"
hear="http://blog.sina.com.cn/m/csbeyond">『csbeyond's blog』blog bbs快乐与的分享,资源与你共享!!! </A></DIV>
<DIV id=Layer1
style="BORDER-RIGHT: #000000 1px; BORDER-TOP: #000000 1px; Z-INDEX: 1; LEFT: 140px; VISIBILITY: hidden; BORDER-LEFT: #000000 1px; WIDTH: 363px; BORDER-BOTTOM: #000000 1px; POSITION: absolute; TOP: 204px; HEIGHT: 115px; BACKGROUND-COLOR: #ffffff; layer-background-color: #FFFFFF">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD bgColor=#6699ff><SPAN
      class=style1><STRONG>&nbsp;&nbsp;选择颜色</STRONG></SPAN></TD>
    <TD bgColor=#6699ff>
      <TABLE borderColor=#ffffff cellSpacing=1 cellPadding=3 width=10
      align=right border=1>
        <TBODY>
        <TR>
          <TD style="CURSOR: hand"
          onclick="MM_showHideLayers('Layer1','','hide')"><SPAN
            class=style1>X</SPAN></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD colSpan=2>
      <SCRIPT language=javascript>
var sID = "tmp_"
var sz, cPick = new Array("00","33","66","99","CC","FF"), iCnt=2
var iColors = cPick.length, szColor = ""
sz = "<TABLE CELLSPACING=0 CELLPADDING=0>"
sz+="<TR>"
sz+="<TD VALIGN=middle width=36 height=36>"
sz+="<DIV CLASS=currentColor ID=\"" + sID + "Current\">&nbsp;<br>&nbsp;<br>&nbsp;</DIV>"
sz+="</TD><TD>"
sz+= "<TABLE ONMOUSEOUT=\"document.all." + sID + "Current.style.backgroundColor = ''\" ONMOUSEOVER=\"document.all." + sID + "Current.style.backgroundColor = event.srcElement.bgColor\" CLASS=colorTable CELLSPACING=0 CELLPADDING=0 ID=\"" + sID + "\">"
for (var r=0;r<iColors;r++) {
sz+="<TR>"
for (var g=iColors-1;g>=0;g--)
for (var b=iColors-1;b>=0;b--) {
szColor = cPick[r]+cPick[g]+cPick[b]
sz+="<TD style='cursor:hand' BGCOLOR='#" + szColor + "' _item='" + szColor + "' TITLE='#" + szColor + "' ONCLICK=\"set_color('" + szColor + "')\">&nbsp;&nbsp;&nbsp;</TD>"
}
sz+="</TR>"
}
sz+="</TABLE></TD></TR></TABLE>"
document.write(sz)
</SCRIPT>
    </TD></TR></TBODY></TABLE></DIV>
<DIV align=center><!--页尾开始-->
<DIV align=center><TD class=style1 bgcolor="#FF0000" width="2"></TD><TD
class=style1 width="1"></TD><TD class="STYLE3 style1" width="447"><SPAN
class=style1><BR></SPAN></DIV></DIV></BODY></HTML>

把上面的代码保存为网页文件htm就可以了,无论是上传到网上在线使用还是

在家里使用都是超方便~

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有