| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 558 人关注过本帖
标题:比赛 ---------看看有哪些高手能翻译下面这段代码
只看楼主 加入收藏
weihuafeng
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-12-22
收藏
 问题点数:0 回复次数:3 
比赛 ---------看看有哪些高手能翻译下面这段代码
本说明:
把如下代码加入<body>区域中:

<SCRIPT LANGUAGE="JavaScript">



function freecol(brtspc,bgcolor)
{
                table("cellspacing='0' cellpadding='0' bgcolor='"+bgcolor+"'");
                tr();
                        td("width='"+brtspc+"'");
                        td("/");
                tr("/");
                table("/");
}

function table(strg)
{
        if (strg != "/")
                document.write("<table "+anfrepl(strg)+">");
        else
                document.write("</table>");
}

function tr(strg)
{
        if (strg != "/")
                document.write("<tr "+anfrepl(strg)+">");
        else
                document.write("</tr>");
}

function td(strg)
{
        if (strg != "/")
                document.write("<td "+anfrepl(strg)+">");
        else
                document.write("</td>");
}

function th(strg)
{
        if (strg != "/")
                document.write("<th "+anfrepl(strg)+">");
        else
                document.write("</th>");
}
                                                        // interpreting ' as " in a string
function anfrepl(strg)
{
        var i;
        var outstring= "";
        if (!strg)//
                strg = "";

        for (i=0;i<strg.length;i++)
        {
                if(strg.charCodeAt(i)==39)
                        outstring = outstring + chr(34);
                else
                        outstring = outstring + strg.charAt(i);
        }
return outstring;
}

function chr(asciiwert)
{
        return String.fromCharCode(asciiwert);
}

function dec2hex(dec)
{
        var result;
        var i,j;
        
        hexChars = "0123456789ABCDEF";
        i = dec % 16;
        j = (dec - i) / 16;
        result = hexChars.charAt(j) + hexChars.charAt(i);
        return result;
}

// Main programm: Sorry 4 the jumble but its hard to combine the structure of the program
// and the structure of the tables.
         
function outtest(which)
{
        var i,j;
        var actwert,hexwert,buchst;
        if (which == false)
                var brtchar = htmchar;
        else
                var brtchar = jschar;
        document.write(anfrepl("<font size='+1'><b>ASCII Table of: "+font+"</b></font><br>"));

table("border='0' cellspacing='0' cellpadding='0' bgcolor='"+bgcolor+"'");
tr();
        td();
                freecol(brtspc,bgcolor);
        td("/");        


        for (i=0 ; i<spalt ; i++)
        {
        td();
                table("cellspacing='0' cellpadding='0' bgcolor='"+bgcolor+"' border='0' bordercolor='Silver' bordercolorlight='Silver' bordercolordark='Silver'");
                tr();
                        th("width='"+(brtdec+2)+"' align='CENTER'");
                                document.write("Dec");
                        th("/");
                        th("width='"+(brthex+2)+"' align='CENTER'");
                                document.write("Hex");
                        th("/");
                        th("<th width='"+(brtchar+2)+"' align='CENTER'");
                                document.write("Chr");
                tr("/");
                table("/");
        td("/");
        td();
                freecol(brtspc,bgcolor);
        td("/");
        }
tr("/");


        for (i=0 ; i<Math.ceil(max/spalt) ; i++)
        {
tr();
        td();
                freecol(brtspc,bgcolor);
        td("/");


                for (j=0 ; j<spalt ; j++)
                {
                        if (Math.floor((i*spalt+j)/((max+1)/100)) <= 100)
                                status = "Building Table: " + Math.floor((i*spalt+j)/((max+1)/100)) + "%"
                        actwert=j*Math.ceil(max/spalt)+i;
                        hexwert=dec2hex(actwert);
                        if (which == false)
                                buchst="&#"+actwert+";";
                        else
                                buchst=chr(actwert);
                        if (actwert > 255)
                                actwert=hexwert=buchst="";

        td();
                table("cellspacing='0' cellpadding='0' bgcolor='White' border='1'");
                tr();
                        td("width='"+brtdec+"' align='CENTER'");
                                document.write(" "+actwert);
                        td("/");
                        td("width='"+brthex+"' align='CENTER'");
                                document.write(" "+hexwert);
                        td("/");
                        th("width='"+brtchar+"' align='CENTER'");
                                document.write(anfrepl("<font face='"+font+"'>"));
                                document.write(" "+buchst);
                                document.write("</font>");
                                
                        th("/");
                tr("/");
                table("/");
        td("/");
        td();
                freecol(brtspc,bgcolor);
        td("/");
                }
tr("/");
        }
status = "Viewing Table: Please wait."
table("/");
}

</SCRIPT>


<SCRIPT LANGUAGE="JavaScript">


        var spalt = 6;                          // number of columns
        var max = 256;                          // mximum ascii value
        var brtdec = 40;                        // width of DEC column
        var brthex = 30;                        // width of HEX column
        var brtspc= 15;                         // width of the space between the columns
        var bgcolor = "silver";         // colour of the spaces
        var htmchar = 60;                       // width of CHR column-HTML-Version (CANCEL Button)
        var jschar = 40;                        // width of CHR column-JS-Version (OK Button)
        var font = "罗马字符"            // Font of the ASCII character

        outtest(confirm("确定:\t字符将用javascript解释.\n取消:\t字符将用HTML来解释. "));


</SCRIPT>

</CENTER>

<SCRIPT LANGUAGE="JavaScript">

        status = "Table ready";

</SCRIPT>
搜索更多相关主题的帖子: 翻译 代码 
2009-12-22 14:15
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
想要翻译?那不如去google的翻译页面
2009-12-22 14:37
weihuafeng
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-12-22
收藏
得分:0 
回复 楼主 weihuafeng
去过,但没有找到工具翻译,你知道怎么做,要不你帮下忙,帮翻译下?十分感谢啦谢谢啦
2009-12-22 14:44
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
构造表格 填充数据
2009-12-23 08:50
快速回复:比赛 ---------看看有哪些高手能翻译下面这段代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017873 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved