<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>WEB页面导出为EXCEL文档的方法</title>
</head>
<body>
<table id="tableExcel" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5" align="center">WEB页面导出为EXCEL文档的方法</td>
</tr>
<tr>
<td>列标题1</td>
<td>列标题2</td>
<td>列标题3</td>
<td>列标题4</td>
<td>列标题5</td>
</tr>
<tr>
<td>aaa</td>
<td>bbb</td>
<td>ccc</td>
<td>ddd</td>
<td>eee</td>
</tr>
<tr>
<td>AAA</td>
<td>BBB</td>
<td>CCC</td>
<td>DDD</td>
<td>EEE</td>
</tr>
<tr>
<td>FFF</td>
<td>GGG</td>
<td>HHH</td>
<td>III</td>
<td>JJJ</td>
</tr>
</table>
<input type="button" onclick="javascript:method1('tableExcel');" value="第一种方法导入到EXCEL">
<input type="button" onclick="javascript:method2('tableExcel');" value="第二种方法导入到EXCEL">
<input type="button" onclick="javascript:getXlsFromTbl('tableExcel',null);" value="第三种方法导入到EXCEL">
<SCRIPT LANGUAGE="javascript">
function method1(tableid) {//整个表格拷贝到EXCEL中
var curTbl = document.getElementById(tableid);
var oXL = new ActiveXObject("Excel.Application");
//创建AX对象excel
var oWB = oXL.Workbooks.Add();
//获取workbook对象
var oSheet = oWB.ActiveSheet;
//激活当前sheet
var sel = document.body.createTextRange();
sel.moveToElementText(curTbl);
//把表格中的内容移到TextRange中
sel.select();
//全选TextRange中内容
sel.execCommand("Copy");
//复制TextRange中内容
oSheet.Paste();
//粘贴到活动的EXCEL中
oXL.Visible = true;
//设置excel可见属性
}
function method2(tableid) //读取表格中每个单元到EXCEL中
{
var curTbl = document.getElementById(tableid);
var oXL = new ActiveXObject("Excel.Application");
//创建AX对象excel
var oWB = oXL.Workbooks.Add();
//获取workbook对象
var oSheet = oWB.ActiveSheet;
//激活当前sheet
var Lenr = curTbl.rows.length;
//取得表格行数
for (i = 0; i < Lenr; i++)
{
var Lenc = curTbl.rows(i).cells.length;
//取得每行的列数
for (j = 0; j < Lenc; j++)
{
oSheet.Cells(i + 1, j + 1).value = curTbl.rows(i).cells(j).innerText;
//赋值
}
}
oXL.Visible = true;
//设置excel可见属性
}
function getXlsFromTbl(inTblId, inWindow) {
try {
var allStr = "";
var curStr = "";
// alert("getXlsFromTbl"); //
if (inTblId != null && inTblId != "" && inTblId != "null") {
curStr = getTblData(inTblId, inWindow);
}
if (curStr != null) {
allStr += curStr;
}
else {
alert("你要导出的表不存在!");
return;
}
var fileName = getExcelFileName();
doFileExport(fileName, allStr);
}
catch(e) {
alert("导出发生异常:" + e.name + "->" + e.description + "!");
}
}
function getTblData(inTbl, inWindow) {
var rows = 0;
// alert("getTblData is " + inWindow); //
var tblDocument = document;
if (!!inWindow && inWindow != "") {
if (!document.all(inWindow)) {
return null;
}
else {
tblDocument = eval(inWindow).document;
}
}
var curTbl = tblDocument.getElementById(inTbl);
var outStr = "";
if (curTbl != null) {
for (var j = 0; j < curTbl.rows.length; j++) {
//alert("j is " + j);
for (var i = 0; i < curTbl.rows[j].cells.length; i++) {
//alert("i is " + i);
if (i == 0 && rows > 0) {
outStr += " \t";
rows -= 1;
}
outStr += curTbl.rows[j].cells[i].innerText + "\t";
if (curTbl.rows[j].cells[i].colSpan > 1) {
for (var k = 0; k < curTbl.rows[j].cells[i].colSpan - 1; k++) {
outStr += " \t";
}
}
if (i == 0) {
if (rows == 0 && curTbl.rows[j].cells[i].rowSpan > 1) {
rows = curTbl.rows[j].cells[i].rowSpan - 1;
}
}
}
outStr += "\r\n";
}
}
else {
outStr = null;
alert(inTbl + "不存在!");
}
}
function getExcelFileName() {
var d = new Date();
var curYear = d.getYear();
var curMonth = "" + (d.getMonth() + 1);
var curDate = "" + d.getDate();
var curHour = "" + d.getHours();
var curMinute = "" + d.getMinutes();
var curSecond = "" + d.getSeconds();
if (curMonth.length == 1) {
curMonth = "0" + curMonth;
}
if (curDate.length == 1) {
curDate = "0" + curDate;
}
if (curHour.length == 1) {
curHour = "0" + curHour;
}
if (curMinute.length == 1) {
curMinute = "0" + curMinute;
}
if (curSecond.length == 1) {
curSecond = "0" + curSecond;
}
var fileName = "leo_zhang" + "_" + curYear + curMonth + curDate + "_"
+ curHour + curMinute + curSecond + ".csv";
//alert(fileName);
return fileName;
}
function doFileExport(inName, inStr) {
var xlsWin = null;
if (!!document.all("glbHideFrm")) {
xlsWin = glbHideFrm;
}
else {
var width = 6;
var height = 4;
var openPara = "left=" + (window.screen.width / 2 - width / 2)
+ ",top=" + (window.screen.height / 2 - height / 2)
+ ",scrollbars=no,width=" + width + ",height=" + height;
xlsWin = window.open("", "_blank", openPara);
}
xlsWin.document.write(inStr);
xlsWin.document.close();
xlsWin.document.execCommand('Saveas', true, inName);
xlsWin.close();
}
</SCRIPT>
</body>
</html>
posted @
2010-04-16 09:47 I LOVE JAVA 阅读(3477) |
评论 (0) |
编辑 收藏
log4j.rootLogger=DEBUG,CONSOLE,DATABASE,FILE
log4j.addivity.org.apache=true
# 应用于控制台
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.Encoding=GBK
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 用于数据库
#log4j.appender.DATABASE=org.apache.log4j.jdbc.JDBCAppender
#log4j.appender.DATABASE.URL=jdbc:mysql://localhost:3306/ww
#log4j.appender.DATABASE.driver=com.mysql.jdbc.Driver
#log4j.appender.DATABASE.user=root
#log4j.appender.DATABASE.password=123
#log4j.appender.CONSOLE.Threshold=WARN
#log4j.appender.DATABASE.sql=INSERT INTO LOG4J(stamp,thread, infolevel,class,messages) VALUES ('%d{yyyy-MM-dd HH:mm:ss}', '%t', '%p', '%l', '%m')
# INSERT INTO LOG4J (Message) VALUES ('[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n')
# 写入数据库中的表LOG4J的Message字段中,内容%d(日期)%c: 日志信息所在地(类名)%p: 日志信息级别%m: 产生的日志具体信息 %n: 输出日志信息换行
#log4j.appender.DATABASE.layout=org.apache.log4j.PatternLayout
#log4j.appender.DATABASE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 每天新建日志
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.File=C:/log4j/log
log4j.appender.A1.Encoding=GBK
log4j.appender.A1.Threshold=DEBUG
log4j.appender.A1.DatePattern='.'yyyy-MM-dd
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L : %m%n
#应用于文件
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=C:/log4j/file.log
log4j.appender.FILE.Append=false
log4j.appender.FILE.Encoding=GBK
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 应用于文件回滚
log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLING_FILE.Threshold=ERROR
log4j.appender.ROLLING_FILE.File=rolling.log
log4j.appender.ROLLING_FILE.Append=true
log4j.appender.CONSOLE_FILE.Encoding=GBK
log4j.appender.ROLLING_FILE.MaxFileSize=10KB
log4j.appender.ROLLING_FILE.MaxBackupIndex=1
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLING_FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
#自定义Appender
log4j.appender.im = net.cybercorlin.util.logger.appender.IMAppender
log4j.appender.im.host = mail.cybercorlin.net
log4j.appender.im.username = username
log4j.appender.im.password = password
log4j.appender.im.recipient = corlin@cybercorlin.net
log4j.appender.im.layout=org.apache.log4j.PatternLayout
log4j.appender.im.layout.ConversionPattern =[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
#应用于socket
log4j.appender.SOCKET=org.apache.log4j.RollingFileAppender
log4j.appender.SOCKET.RemoteHost=localhost
log4j.appender.SOCKET.Port=5001
log4j.appender.SOCKET.LocationInfo=true
# Set up for Log Facter 5
log4j.appender.SOCKET.layout=org.apache.log4j.PatternLayout
log4j.appender.SOCET.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD]%n%c[CATEGORY]%n%m[MESSAGE]%n%n
# Log Factor 5 Appender
log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender
log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000
# 发送日志给邮件
log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.MAIL.Threshold=FATAL
log4j.appender.MAIL.BufferSize=10
log4j.appender.MAIL.From=web@www.wuset.com
log4j.appender.MAIL.SMTPHost=www.wusetu.com
log4j.appender.MAIL.Subject=Log4J Message
log4j.appender.MAIL.To=web@www.wusetu.com
log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.MAIL.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
posted @
2009-03-23 10:10 I LOVE JAVA 阅读(1358) |
评论 (0) |
编辑 收藏
<script language="JavaScript">
<!--
function TwoSelectInit(so,dv1,dv2){
var o1=so.o1;var o2=so.o2;var allstr=so.str;var dt1=so.dt1;var dt2=so.dt2;var selectonce=so.selectonce;
var _s = "*|^@";
var s1=new Array(),v1=new Array(),s2=new Array(),v2=new Array();
var s1i = 0,s2i = 0;
if(dt1!=""){
if(!selectonce){allstr=dt1+_s.charAt(1)+_s.charAt(0)+allstr;}
else{allstr=dt1+_s.charAt(1)+dt2+_s.charAt(0)+allstr;}
}
aa=allstr.split(_s.charAt(0));
for(aai=0;aai<aa.length;aai++){
aaa=aa[aai].split(_s.charAt(1));
tmps1 = aaa[0].split(_s.charAt(3));
s1[aai] = tmps1[0];v1[aai] = (tmps1.length==2)?tmps1[1]:tmps1[0];
s2[aai] = new Array();v2[aai] = new Array();
if(v1[aai]==dv1){s1i = aai;}
bbbb=aaa[1];
if(dt2!=""&&!selectonce){if(bbbb==""){bbbb=dt2;}else{bbbb=dt2+_s.charAt(2)+bbbb;}}
bb=bbbb.split(_s.charAt(2));
for(bbi=0;bbi< bb.length;bbi++){
tmps2 = bb[bbi].split(_s.charAt(3));
s2[aai][bbi] = tmps2[0];v2[aai][bbi] = (tmps2.length==2)?tmps2[1]:tmps2[0];
if(v2[aai][bbi]==dv2){s2i = bbi;}
}
}
for(var i=0;i<o1.options.length;i++){o1.remove(i);i--;}
for(k=0;k<s1.length;k++){o1.options.add(new Option(s1[k],v1[k]));}
o1.selectedIndex=s1i;
for(var i=0;i<o2.options.length;i++){o2.remove(i);i--;}
for(k=0;k<s2[s1i].length;k++){o2.options.add(new Option(s2[s1i][k],v2[s1i][k]));}
o2.selectedIndex=s2i;
}
function HwTwoSelect(o1,o2,liststr,dt1,dt2,t){this.o1=o1;this.o2=o2;this.str=liststr;this.dt1=dt1;this.dt2=dt2;this.selectonce=t}
//-->
</SCRIPT>
<form method="post" name=myform>
选择一次:<select name="a" onchange="TwoSelectInit(test1,this.value)"></select> <select name="b"></select><hr>
选择两次:<select name="aa" onchange="TwoSelectInit(test2,this.value)"></select> <select name="bb"></select><hr>
有初始值:<select name="aaa" onchange="TwoSelectInit(test3,this.value)"></select> <select name="bbb"></select>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
var selecttext=""
+"搜索@search|Google@http://www.google.com/^Yahoo@http://www.yahoo.com/"
+"*收藏@fav|无忧视窗@http://www.51windows.Net/^蓝色理想@http://www.blueidea.com/^POPO@http://plod.popoever.net/"
+"";
var test1 = new HwTwoSelect(document.myform.a,document.myform.b,selecttext,"-分类-@","-网址-@",1);//最后的参数表示,选了一级菜单后,二级菜单是否还要显示“请选择”,1或true代码,不显示,0或false代表显示
TwoSelectInit(test1);
var test2 = new HwTwoSelect(document.myform.aa,document.myform.bb,selecttext,"-分类-@","-网址-@",0);
TwoSelectInit(test2);
var test3 = new HwTwoSelect(document.myform.aaa,document.myform.bbb,selecttext,"-分类-@","-网址-@",0);
TwoSelectInit(test3,"fav","http://www.51windows.Net/");
//-->
</SCRIPT>
以下是示例代码,详细请查看源文件:
<form method="post" name=myform>
<select name="select1" onchange="TwoSelectInit(ttt,this.value)"></select> <select name="select2"></select><hr>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
var selecttext=""
+"搜索@search|Google@http://www.google.com/^Yahoo@http://www.yahoo.com/"
+"*收藏@fav|无忧视窗@http://www.51windows.Net/^蓝色理想@http://www.blueidea.com/^POPO@http://plod.popoever.net/"
+"";
var ttt = new HwTwoSelect(document.myform.select1,document.myform.select2,selecttext,"-分类-@","-网址-@",1);
TwoSelectInit(ttt ,"fav","http://www.51windows.Net/");
//-->
</SCRIPT>
bug:在二级菜单有初始值时,如果表单重置,二级菜单的值会变为空
posted @
2007-10-19 11:06 I LOVE JAVA 阅读(646) |
评论 (0) |
编辑 收藏
<SCRIPT LANGUAGE="JavaScript">
<!--
function CreateSelect(_FormName,_SName,_SValue,_Ds,_AllOptionStr,ShowType)
{
//三级关链菜单通用版
//作者:海娃, 有问题请到http://www.51windows.Net留言。
if (_FormName=="")
_FormName = "all"
var _DsArr = _Ds.split("|")
var _Ds1,_Ds2,_Ds3
var _Ds1 = _DsArr[0]
var _Ds2 = (_DsArr.length>1)?_DsArr[1]:_DsArr[0]
var _Ds3 = (_DsArr.length>2)?_DsArr[2]:_DsArr[0]
var _SNameArr = _SName.split("|")
var _SName1,_SName2,_SName3
var _SName1 = _SNameArr[0]
var _SName2 = (_SNameArr.length>1)?_SNameArr[1]:_SNameArr[0]
var _SName3 = (_SNameArr.length>2)?_SNameArr[2]:_SNameArr[0]
var _SValueArr = _SValue.split("|")
var _SValue1,_SValue2,_SValue3
var _SValue1 = _SValueArr[0]
var _SValue2 = (_SValueArr.length>1)?_SValueArr[1]:_SValueArr[0]
var _SValue3 = (_SValueArr.length>2)?_SValueArr[2]:_SValueArr[0]
if (ShowType==3){
_AllOptionStr = _AllOptionStr.replace(/\(\(/ig,"\(\("+_Ds3+"\^")
_AllOptionStr = _AllOptionStr.replace(/\{\{/ig,"\{\{"+_Ds2+"\(\("+_Ds3+"\*\*")
}
else if(ShowType==2){
_AllOptionStr = _AllOptionStr.replace(/\{\{/ig,"\{\{"+_Ds2+"\(\("+_Ds3+"\*\*")
}
else if(ShowType==1){
_AllOptionStr = _AllOptionStr.replace(/\(\(/ig,"\(\("+_Ds3+"\^")
}
var AllStr = _Ds1 + "{{"+ _Ds2 + "(("+ _Ds3 +"||"+_AllOptionStr
//alert(AllStr)
var _AR0 = AllStr.split("||");
document.writeln("<select name=\"" + _SName1 + "\" size=\"1\" onChange=\""+_SName1+"redirect(this.options.selectedIndex)\">");
for (var i1 = 0;i1 < _AR0.length;i1++)
{
var Area1Str = _AR0[i1];
var _AR10 = Area1Str.split("{{");
var _AR11 = _AR10[0].split("@");
var Tstr1 = _AR11[0];
var Vstr1 = (_AR11.length==2)?_AR11[1]:_AR11[0]
document.writeln("<option value=\""+Vstr1+"\">"+Tstr1+"<\/option>");
}
document.writeln("<\/select>");
document.writeln("<select name=\"" + _SName2 + "\" size=\"1\" onChange=\""+_SName1+"redirect1(this.options.selectedIndex)\">");
var _AR111 = _Ds2.split("@");
var Tstr11 = _AR111[0];
var Vstr11 = (_AR111.length==2)?_AR111[1]:_AR111[0];
document.writeln("<option value=\""+Vstr11+"\">"+Tstr11+"<\/option>");
document.writeln("<\/select>");
document.writeln("<select name=\"" + _SName3 + "\" size=\"1\">");
var _AR222 = _Ds3.split("@");
var Tstr22 = _AR222[0];
var Vstr22 = (_AR222.length==2)?_AR222[1]:_AR222[0];
document.writeln("<option value=\""+Vstr22+"\">"+Tstr22+"<\/option>");
document.writeln("<\/select>");
document.writeln("<S"+"CRIPT LANGUAGE=\"JavaScript\" defer>");
document.writeln("<!--");
document.writeln("var "+_SName1+"NewAllStr = \""+ AllStr +"\"");
document.writeln("var "+_SName1+"_AR0 = "+_SName1+"NewAllStr.split(\"||\");");
document.writeln("var "+_SName1+"groups=document."+ _FormName +"." + _SName1 + ".options.length;");
document.writeln("var "+_SName1+"group=new Array("+_SName1+"groups)");
document.writeln("for (i=0; i<"+_SName1+"groups; i++){");
document.writeln(" "+_SName1+"group[i]=new Array();");
document.writeln("}");
document.writeln("for (var i1 = 0;i1 < "+_SName1+"_AR0.length;i1++){");
document.writeln(" var Area1Str = "+_SName1+"_AR0[i1];");
document.writeln(" var _AR10 = Area1Str.split(\"{{\");");
document.writeln(" var _AR12 = _AR10[1].split(\"**\");");
document.writeln(" for (var i2 = 0;i2 < _AR12.length;i2++){");
document.writeln(" var Area2Str = _AR12[i2];");
document.writeln(" var _AR20 = Area2Str.split(\"((\");");
document.writeln(" var _AR211 = _AR20[0].split(\"@\");");
document.writeln(" var Tstr2 = _AR211[0];");
document.writeln(" var Vstr2 = (_AR211.length==2)?_AR211[1]:_AR211[0];");
document.writeln(" "+_SName1+"group[i1][i2]=new Option(Tstr2,Vstr2);");
document.writeln(" }");
document.writeln("}");
document.writeln("var "+_SName1+"temp = document."+ _FormName +"." + _SName2);
document.writeln("function "+_SName1+"redirect(x){");
document.writeln(" for (m="+_SName1+"temp.options.length-1;m>0;m--)");
document.writeln(" "+_SName1+"temp.options[m]=null;");
document.writeln(" for (i=0;i<"+_SName1+"group[x].length;i++){");
document.writeln(" "+_SName1+"temp.options[i]=new Option("+_SName1+"group[x][i].text,"+_SName1+"group[x][i].value);");
document.writeln(" }");
document.writeln(" "+_SName1+"temp.options[0].selected=true");
document.writeln(" "+_SName1+"redirect1(0)");
document.writeln("}");
document.writeln("var "+_SName1+"Group2s=document."+ _FormName +"." + _SName2 + ".options.length;");
document.writeln("var "+_SName1+"Group2=new Array("+_SName1+"groups);");
document.writeln("for (i=0; i<"+_SName1+"groups; i++){");
document.writeln(" "+_SName1+"Group2[i]=new Array("+_SName1+"group[i].length)");
document.writeln(" for (j=0; j<"+_SName1+"group[i].length; j++){");
document.writeln(" "+_SName1+"Group2[i][j]=new Array()");
document.writeln(" }");
document.writeln("}");
document.writeln("for (var i1 = 0;i1 < "+_SName1+"_AR0.length;i1++){");
document.writeln(" var Area1Str = "+_SName1+"_AR0[i1]");
document.writeln(" var _AR10 = Area1Str.split(\"{{\");");
document.writeln(" var _AR12 = _AR10[1].split(\"**\");");
document.writeln(" for (var i2 = 0;i2 < _AR12.length;i2++){");
document.writeln(" var Area2Str = _AR12[i2]");
document.writeln(" var _AR20 = Area2Str.split(\"((\");");
document.writeln(" _AR212 = _AR20[1].split(\"^\");");
document.writeln(" for (var i3 = 0;i3 < _AR212.length;i3++){");
document.writeln(" Area3Str = _AR212[i3]");
document.writeln(" _AR3 = Area3Str.split(\"@\");");
document.writeln(" Tstr3 = _AR3[0]");
document.writeln(" Vstr3 = (_AR3.length==2)?_AR3[1]:_AR3[0]");
document.writeln(" "+_SName1+"Group2[i1][i2][i3]=new Option(Tstr3,Vstr3);");
document.writeln(" }");
document.writeln(" }");
document.writeln("}");
document.writeln("var "+_SName1+"temp1=document."+ _FormName +"." + _SName3 + "");
document.writeln("function "+_SName1+"redirect1(y){");
document.writeln(" for (m="+_SName1+"temp1.options.length-1;m>0;m--)");
document.writeln(" "+_SName1+"temp1.options[m]=null");
document.writeln(" for (i=0;i<"+_SName1+"Group2[document."+ _FormName +"." + _SName1 + ".options.selectedIndex][y].length;i++){");
document.writeln(" "+_SName1+"temp1.options[i]=new Option("+_SName1+"Group2[document."+ _FormName +"." + _SName1 + ".options.selectedIndex][y][i].text," + _SName1 + "Group2[document."+ _FormName +"." + _SName1 + ".options.selectedIndex][y][i].value)");
document.writeln(" }");
document.writeln(" "+_SName1+"temp1.options[0].selected=true");
document.writeln("}");
document.writeln("\/\/-->");
document.writeln("<\/script>");
document.writeln("<s"+"cript language=\"JavaScript\">");
document.writeln("<!--");
document.writeln("function "+_SName1+"SetValue(){");
document.writeln(" try{");
document.writeln(" if (\""+_SValue1+"\"!=\"\"){");
document.writeln(" document."+ _FormName +"."+_SName1+".value=\""+_SValue1+"\"");
document.writeln(" "+_SName1+"redirect(document."+ _FormName +"."+_SName1+".options.selectedIndex);");
document.writeln(" if (\""+_SValue2+"\"!=\"\"){");
document.writeln(" document."+ _FormName +"."+_SName2+".value=\""+_SValue2+"\"");
document.writeln(" "+_SName1+"redirect1(document."+ _FormName +"."+_SName2+".options.selectedIndex)");
document.writeln(" if (\""+_SValue3+"\"!=\"\")");
document.writeln(" document."+ _FormName +"."+_SName3+".value=\""+_SValue3+"\"");
document.writeln(" }");
document.writeln(" }");
document.writeln(" }");
document.writeln(" catch(e){");
document.writeln(" }");
document.writeln("}");
document.writeln("window.attachEvent(\"onload\","+_SName1+"SetValue)");
document.writeln("\/\/-->");
document.writeln("<\/script>");
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
var AllStr1 = ""
+"东北地区{{"
+"黑龙江((哈尔滨^齐齐哈尔^牡丹江^佳木斯^大庆^绥化^鹤岗^鸡西^黑河^双鸭山^伊春^七台河^大兴安岭"
+"**吉林((长春^吉林^四平^辽源^通化^白山^松原^白城^延边"
+"**辽宁((沈阳^大连^鞍山^抚顺^本溪^丹东^锦州^营口^阜新^辽阳^盘锦^铁岭^朝阳^葫芦岛"
+"||华北地区{{"
+"北京((东城^西城^崇文^宣武^朝阳^丰台^石景山^海淀^门头沟^房山^通州^顺义^昌平^大兴^平谷^怀柔^密云^延庆"
+"**天津((和平^东丽^河东^西青^河西^津南^南开^北辰^河北^武清^红挢^塘沽^汉沽^大港^宁河^静海^宝坻^蓟县"
+"**山东((济南^青岛^淄博^枣庄^东营^烟台^潍坊^济宁^泰安^威海^日照^莱芜^临沂^德州^聊城^滨州^菏泽"
+"**河北((石家庄^邯郸^邢台^保定^张家口^承德^廊坊^唐山^秦皇岛^沧州^衡水"
+"**河南((郑州^开封^洛阳^平顶山^安阳^鹤壁^新乡^焦作^濮阳^许昌^漯河^三门峡^南阳^商丘^信阳^周口^驻马店^济源"
+"**山西((太原^大同^阳泉^长治^晋城^朔州^吕梁^忻州^晋中^临汾^运城"
+"**内蒙古((呼和浩特^包头^乌海^赤峰^呼伦贝尔盟^阿拉善盟^哲里木盟^兴安盟^乌兰察布盟^锡林郭勒盟^巴彦淖尔盟^伊克昭盟"
+"||华中地区{{"
+"湖北((武汉^宜昌^荆州^襄樊^黄石^荆门^黄冈^十堰^恩施^潜江^天门^仙桃^随州^咸宁^孝感^鄂州"
+"**湖南((长沙^常德^株洲^湘潭^衡阳^岳阳^邵阳^益阳^娄底^怀化^郴州^永州^湘西^张家界"
+"||华南地区{{"
+"广东((广州^深圳^珠海^汕头^东莞^中山^佛山^韶关^江门^湛江^茂名^肇庆^惠州^梅州^汕尾^河源^阳江^清远^潮州^揭阳^云浮"
+"**广西((南宁^柳州^桂林^梧州^北海^防城港^钦州^贵港^玉林^南宁地区^柳州地区^贺州^百色^河池"
+"**福建((福州^厦门^莆田^三明^泉州^漳州^南平^龙岩^宁德"
+"**海南((海口^三亚"
+"||西南地区{{"
+"四川((成都^绵阳^德阳^自贡^攀枝花^广元^内江^乐山^南充^宜宾^广安^达川^雅安^眉山^甘孜^凉山^泸州"
+"**重庆((万州^涪陵^渝中^大渡口^江北^沙坪坝^九龙坡^南岸^北碚^万盛^双挢^渝北^巴南^黔江^长寿^綦江^潼南^铜梁^大足^荣昌^壁山^梁平^城口^丰都^垫江^武隆^忠县^开县^云阳^奉节^巫山^巫溪^石柱^秀山^酉阳^彭水^江津^合川^永川^南川"
+"**贵州((贵阳^六盘水^遵义^安顺^铜仁^黔西南^毕节^黔东南^黔南"
+"**云南((昆明^大理^曲靖^玉溪^昭通^楚雄^红河^文山^思茅^西双版纳^保山^德宏^丽江^怒江^迪庆^临沧"
+"**西藏((拉萨^日喀则^山南^林芝^昌都^阿里^那曲"
+"||西北地区{{"
+"陕西((西安^宝鸡^咸阳^铜川^渭南^延安^榆林^汉中^安康^商洛"
+"**甘肃((兰州^嘉峪关^金昌^白银^天水^酒泉^张掖^武威^定西^陇南^平凉^庆阳^临夏^甘南"
+"**宁夏((银川^石嘴山^吴忠^固原"
+"**青海((西宁^海东^海南^海北^黄南^玉树^果洛^海西"
+"**新疆((乌鲁木齐^石河子^克拉玛依^伊犁^巴音郭勒^昌吉^克孜勒苏柯尔克孜^博尔塔拉^吐鲁番^哈密^喀什^和田^阿克苏"
+"||华东地区{{"
+"上海((黄浦^卢湾^徐汇^长宁^静安^普陀^闸北^虹口^杨浦^闵行^宝山^嘉定^浦东^金山^松江^青浦^南汇^奉贤^崇明"
+"**江苏((南京^镇江^苏州^南通^扬州^盐城^徐州^连云港^常州^无锡^宿迁^泰州^淮安"
+"**浙江((杭州^宁波^温州^嘉兴^湖州^绍兴^金华^衢州^舟山^台州^丽水"
+"**安徽((合肥^芜湖^蚌埠^马鞍山^淮北^铜陵^安庆^黄山^滁州^宿州^池州^淮南^巢湖^阜阳^六安^宣城^亳州"
+"**江西((南昌市^景德镇^九江^鹰潭^萍乡^新馀^赣州^吉安^宜春^抚州^上饶"
+"||港澳台地区{{"
+"香港((香港"
+"**澳门((澳门"
+"**台湾((台北^高雄^台中^台南^屏东^南投^云林^新竹^彰化^苗栗^嘉义^花莲^桃园^宜兰^基隆^台东^金门^马祖^澎湖"
+"||其它地区{{"
+"其它((其它"
//-->
</SCRIPT>
以下代码加到body中(简要说明之前)
<FORM name="HwForm">
<HR>选择一次<br>
<SCRIPT LANGUAGE="JavaScript">
CreateSelect("","S_13|S_23|S_33","","请选择地区@|请选择省份@|请选择城市@",AllStr1,0);
</SCRIPT>
<HR>选择三次<br>
<SCRIPT LANGUAGE="JavaScript">
CreateSelect("HwForm","S_1|S_2|S_3","华北地区|山东|济宁","请选择地区@|请选择省份@|请选择城市@",AllStr1,3);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
var AllStr2 = ""
+"笔记本{{"
+"IBM((R32^T40^T42"
+"**DELL((N600^M600"
+"||数码相机{{"
+"CANON((A75^A80^A85"
+"**SONY((S80^S60"
//-->
</SCRIPT>
<HR>选择二次<br><SCRIPT LANGUAGE="JavaScript">
CreateSelect("HwForm","S_11|S_21|S_31","笔记本|IBM|T42","请选择分类@|请选择品牌@|请选择系列@",AllStr2,2);
</SCRIPT>
<HR>选择二次<br><SCRIPT LANGUAGE="JavaScript">
CreateSelect("HwForm","S_12|S_22|S_32","","请选择分类@|请选择品牌@|请选择系列@",AllStr2,1);
</SCRIPT>
</FORM>
简要说明:
<FORM name="HwForm">
<SCRIPT LANGUAGE="JavaScript">
CreateSelect("HwForm","S_1|S_2|S_3","华北地区|山东|济宁","请选择地区@|请选择省份@|请选择城市@",AllStr1,3);
</SCRIPT>
</FORM>
HwForm是表单的名字
而
S_1|S_2|S_3是三个Select表单的名字,如果在js中,可以用doucment.HwForm.S_1.value得到选中的一级的值
如果在asp中,可以用Request("S_3")得到选中的三级值
posted @
2007-10-19 10:41 I LOVE JAVA 阅读(434) |
评论 (0) |
编辑 收藏
package com.easydozer.commons.util;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
/**
* <pre>汉字转化为全拼</pre>
* <BR><DL><DT><B>JDK版本:</B></DT><BR><DD>1.4</DD></DL>
* @author 谢计生
* @version 1.0
* @see
* @since 1.0
*/
public class CnToSpell
{
private static LinkedHashMap spellMap = null;
static
{
if(spellMap == null){
spellMap = new LinkedHashMap(400);
}
initialize();
System.out.println("Chinese transfer Spell Done.");
}
private CnToSpell()
{
}
private static void spellPut(String spell,int ascii)
{
spellMap.put(spell,new Integer(ascii));
}
private static void initialize()
{
spellPut("a", -20319);
spellPut("ai", -20317);
spellPut("an", -20304);
spellPut("ang", -20295);
spellPut("ao", -20292);
spellPut("ba", -20283);
spellPut("bai", -20265);
spellPut("ban", -20257);
spellPut("bang", -20242);
spellPut("bao", -20230);
spellPut("bei", -20051);
spellPut("ben", -20036);
spellPut("beng", -20032);
spellPut("bi", -20026);
spellPut("bian", -20002);
spellPut("biao", -19990);
spellPut("bie", -19986);
spellPut("bin", -19982);
spellPut("bing", -19976);
spellPut("bo", -19805);
spellPut("bu", -19784);
spellPut("ca", -19775);
spellPut("cai", -19774);
spellPut("can", -19763);
spellPut("cang", -19756);
spellPut("cao", -19751);
spellPut("ce", -19746);
spellPut("ceng", -19741);
spellPut("cha", -19739);
spellPut("chai", -19728);
spellPut("chan", -19725);
spellPut("chang", -19715);
spellPut("chao", -19540);
spellPut("che", -19531);
spellPut("chen", -19525);
spellPut("cheng", -19515);
spellPut("chi", -19500);
spellPut("chong", -19484);
spellPut("chou", -19479);
spellPut("chu", -19467);
spellPut("chuai", -19289);
spellPut("chuan", -19288);
spellPut("chuang", -19281);
spellPut("chui", -19275);
spellPut("chun", -19270);
spellPut("chuo", -19263);
spellPut("ci", -19261);
spellPut("cong", -19249);
spellPut("cou", -19243);
spellPut("cu", -19242);
spellPut("cuan", -19238);
spellPut("cui", -19235);
spellPut("cun", -19227);
spellPut("cuo", -19224);
spellPut("da", -19218);
spellPut("dai", -19212);
spellPut("dan", -19038);
spellPut("dang", -19023);
spellPut("dao", -19018);
spellPut("de", -19006);
spellPut("deng", -19003);
spellPut("di", -18996);
spellPut("dian", -18977);
spellPut("diao", -18961);
spellPut("die", -18952);
spellPut("ding", -18783);
spellPut("diu", -18774);
spellPut("dong", -18773);
spellPut("dou", -18763);
spellPut("du", -18756);
spellPut("duan", -18741);
spellPut("dui", -18735);
spellPut("dun", -18731);
spellPut("duo", -18722);
spellPut("e", -18710);
spellPut("en", -18697);
spellPut("er", -18696);
spellPut("fa", -18526);
spellPut("fan", -18518);
spellPut("fang", -18501);
spellPut("fei", -18490);
spellPut("fen", -18478);
spellPut("feng", -18463);
spellPut("fo", -18448);
spellPut("fou", -18447);
spellPut("fu", -18446);
spellPut("ga", -18239);
spellPut("gai", -18237);
spellPut("gan", -18231);
spellPut("gang", -18220);
spellPut("gao", -18211);
spellPut("ge", -18201);
spellPut("gei", -18184);
spellPut("gen", -18183);
spellPut("geng", -18181);
spellPut("gong", -18012);
spellPut("gou", -17997);
spellPut("gu", -17988);
spellPut("gua", -17970);
spellPut("guai", -17964);
spellPut("guan", -17961);
spellPut("guang", -17950);
spellPut("gui", -17947);
spellPut("gun", -17931);
spellPut("guo", -17928);
spellPut("ha", -17922);
spellPut("hai", -17759);
spellPut("han", -17752);
spellPut("hang", -17733);
spellPut("hao", -17730);
spellPut("he", -17721);
spellPut("hei", -17703);
spellPut("hen", -17701);
spellPut("heng", -17697);
spellPut("hong", -17692);
spellPut("hou", -17683);
spellPut("hu", -17676);
spellPut("hua", -17496);
spellPut("huai", -17487);
spellPut("huan", -17482);
spellPut("huang", -17468);
spellPut("hui", -17454);
spellPut("hun", -17433);
spellPut("huo", -17427);
spellPut("ji", -17417);
spellPut("jia", -17202);
spellPut("jian", -17185);
spellPut("jiang", -16983);
spellPut("jiao", -16970);
spellPut("jie", -16942);
spellPut("jin", -16915);
spellPut("jing", -16733);
spellPut("jiong", -16708);
spellPut("jiu", -16706);
spellPut("ju", -16689);
spellPut("juan", -16664);
spellPut("jue", -16657);
spellPut("jun", -16647);
spellPut("ka", -16474);
spellPut("kai", -16470);
spellPut("kan", -16465);
spellPut("kang", -16459);
spellPut("kao", -16452);
spellPut("ke", -16448);
spellPut("ken", -16433);
spellPut("keng", -16429);
spellPut("kong", -16427);
spellPut("kou", -16423);
spellPut("ku", -16419);
spellPut("kua", -16412);
spellPut("kuai", -16407);
spellPut("kuan", -16403);
spellPut("kuang", -16401);
spellPut("kui", -16393);
spellPut("kun", -16220);
spellPut("kuo", -16216);
spellPut("la", -16212);
spellPut("lai", -16205);
spellPut("lan", -16202);
spellPut("lang", -16187);
spellPut("lao", -16180);
spellPut("le", -16171);
spellPut("lei", -16169);
spellPut("leng", -16158);
spellPut("li", -16155);
spellPut("lia", -15959);
spellPut("lian", -15958);
spellPut("liang", -15944);
spellPut("liao", -15933);
spellPut("lie", -15920);
spellPut("lin", -15915);
spellPut("ling", -15903);
spellPut("liu", -15889);
spellPut("long", -15878);
spellPut("lou", -15707);
spellPut("lu", -15701);
spellPut("lv", -15681);
spellPut("luan", -15667);
spellPut("lue", -15661);
spellPut("lun", -15659);
spellPut("luo", -15652);
spellPut("ma", -15640);
spellPut("mai", -15631);
spellPut("man", -15625);
spellPut("mang", -15454);
spellPut("mao", -15448);
spellPut("me", -15436);
spellPut("mei", -15435);
spellPut("men", -15419);
spellPut("meng", -15416);
spellPut("mi", -15408);
spellPut("mian", -15394);
spellPut("miao", -15385);
spellPut("mie", -15377);
spellPut("min", -15375);
spellPut("ming", -15369);
spellPut("miu", -15363);
spellPut("mo", -15362);
spellPut("mou", -15183);
spellPut("mu", -15180);
spellPut("na", -15165);
spellPut("nai", -15158);
spellPut("nan", -15153);
spellPut("nang", -15150);
spellPut("nao", -15149);
spellPut("ne", -15144);
spellPut("nei", -15143);
spellPut("nen", -15141);
spellPut("neng", -15140);
spellPut("ni", -15139);
spellPut("nian", -15128);
spellPut("niang", -15121);
spellPut("niao", -15119);
spellPut("nie", -15117);
spellPut("nin", -15110);
spellPut("ning", -15109);
spellPut("niu", -14941);
spellPut("nong", -14937);
spellPut("nu", -14933);
spellPut("nv", -14930);
spellPut("nuan", -14929);
spellPut("nue", -14928);
spellPut("nuo", -14926);
spellPut("o", -14922);
spellPut("ou", -14921);
spellPut("pa", -14914);
spellPut("pai", -14908);
spellPut("pan", -14902);
spellPut("pang", -14894);
spellPut("pao", -14889);
spellPut("pei", -14882);
spellPut("pen", -14873);
spellPut("peng", -14871);
spellPut("pi", -14857);
spellPut("pian", -14678);
spellPut("piao", -14674);
spellPut("pie", -14670);
spellPut("pin", -14668);
spellPut("ping", -14663);
spellPut("po", -14654);
spellPut("pu", -14645);
spellPut("qi", -14630);
spellPut("qia", -14594);
spellPut("qian", -14429);
spellPut("qiang", -14407);
spellPut("qiao", -14399);
spellPut("qie", -14384);
spellPut("qin", -14379);
spellPut("qing", -14368);
spellPut("qiong", -14355);
spellPut("qiu", -14353);
spellPut("qu", -14345);
spellPut("quan", -14170);
spellPut("que", -14159);
spellPut("qun", -14151);
spellPut("ran", -14149);
spellPut("rang", -14145);
spellPut("rao", -14140);
spellPut("re", -14137);
spellPut("ren", -14135);
spellPut("reng", -14125);
spellPut("ri", -14123);
spellPut("rong", -14122);
spellPut("rou", -14112);
spellPut("ru", -14109);
spellPut("ruan", -14099);
spellPut("rui", -14097);
spellPut("run", -14094);
spellPut("ruo", -14092);
spellPut("sa", -14090);
spellPut("sai", -14087);
spellPut("san", -14083);
spellPut("sang", -13917);
spellPut("sao", -13914);
spellPut("se", -13910);
spellPut("sen", -13907);
spellPut("seng", -13906);
spellPut("sha", -13905);
spellPut("shai", -13896);
spellPut("shan", -13894);
spellPut("shang", -13878);
spellPut("shao", -13870);
spellPut("she", -13859);
spellPut("shen", -13847);
spellPut("sheng", -13831);
spellPut("shi", -13658);
spellPut("shou", -13611);
spellPut("shu", -13601);
spellPut("shua", -13406);
spellPut("shuai", -13404);
spellPut("shuan", -13400);
spellPut("shuang", -13398);
spellPut("shui", -13395);
spellPut("shun", -13391);
spellPut("shuo", -13387);
spellPut("si", -13383);
spellPut("song", -13367);
spellPut("sou", -13359);
spellPut("su", -13356);
spellPut("suan", -13343);
spellPut("sui", -13340);
spellPut("sun", -13329);
spellPut("suo", -13326);
spellPut("ta", -13318);
spellPut("tai", -13147);
spellPut("tan", -13138);
spellPut("tang", -13120);
spellPut("tao", -13107);
spellPut("te", -13096);
spellPut("teng", -13095);
spellPut("ti", -13091);
spellPut("tian", -13076);
spellPut("tiao", -13068);
spellPut("tie", -13063);
spellPut("ting", -13060);
spellPut("tong", -12888);
spellPut("tou", -12875);
spellPut("tu", -12871);
spellPut("tuan", -12860);
spellPut("tui", -12858);
spellPut("tun", -12852);
spellPut("tuo", -12849);
spellPut("wa", -12838);
spellPut("wai", -12831);
spellPut("wan", -12829);
spellPut("wang", -12812);
spellPut("wei", -12802);
spellPut("wen", -12607);
spellPut("weng", -12597);
spellPut("wo", -12594);
spellPut("wu", -12585);
spellPut("xi", -12556);
spellPut("xia", -12359);
spellPut("xian", -12346);
spellPut("xiang", -12320);
spellPut("xiao", -12300);
spellPut("xie", -12120);
spellPut("xin", -12099);
spellPut("xing", -12089);
spellPut("xiong", -12074);
spellPut("xiu", -12067);
spellPut("xu", -12058);
spellPut("xuan", -12039);
spellPut("xue", -11867);
spellPut("xun", -11861);
spellPut("ya", -11847);
spellPut("yan", -11831);
spellPut("yang", -11798);
spellPut("yao", -11781);
spellPut("ye", -11604);
spellPut("yi", -11589);
spellPut("yin", -11536);
spellPut("ying", -11358);
spellPut("yo", -11340);
spellPut("yong", -11339);
spellPut("you", -11324);
spellPut("yu", -11303);
spellPut("yuan", -11097);
spellPut("yue", -11077);
spellPut("yun", -11067);
spellPut("za", -11055);
spellPut("zai", -11052);
spellPut("zan", -11045);
spellPut("zang", -11041);
spellPut("zao", -11038);
spellPut("ze", -11024);
spellPut("zei", -11020);
spellPut("zen", -11019);
spellPut("zeng", -11018);
spellPut("zha", -11014);
spellPut("zhai", -10838);
spellPut("zhan", -10832);
spellPut("zhang", -10815);
spellPut("zhao", -10800);
spellPut("zhe", -10790);
spellPut("zhen", -10780);
spellPut("zheng", -10764);
spellPut("zhi", -10587);
spellPut("zhong", -10544);
spellPut("zhou", -10533);
spellPut("zhu", -10519);
spellPut("zhua", -10331);
spellPut("zhuai", -10329);
spellPut("zhuan", -10328);
spellPut("zhuang", -10322);
spellPut("zhui", -10315);
spellPut("zhun", -10309);
spellPut("zhuo", -10307);
spellPut("zi", -10296);
spellPut("zong", -10281);
spellPut("zou", -10274);
spellPut("zu", -10270);
spellPut("zuan", -10262);
spellPut("zui", -10260);
spellPut("zun", -10256);
spellPut("zuo", -10254);
}
/**
* 获得单个汉字的Ascii.
* @param cn char
* 汉字字符
* @return int
* 错误返回 0,否则返回ascii
*/
public static int getCnAscii(char cn)
{
byte[] bytes = (String.valueOf(cn)).getBytes();
if(bytes == null || bytes.length > 2 || bytes.length <= 0){ //错误
return 0;
}
if(bytes.length == 1){ //英文字符
return bytes[0];
}
if(bytes.length == 2){ //中文字符
int hightByte = 256 + bytes[0];
int lowByte = 256 + bytes[1];
int ascii = (256 * hightByte + lowByte) - 256 * 256;
//System.out.println("ASCII=" + ascii);
return ascii;
}
return 0; //错误
}
/**
* 根据ASCII码到SpellMap中查找对应的拼音
* @param ascii int
* 字符对应的ASCII
* @return String
* 拼音,首先判断ASCII是否>0&<160,如果是返回对应的字符,
* <BR>否则到SpellMap中查找,如果没有找到拼音,则返回null,如果找到则返回拼音.
*/
public static String getSpellByAscii(int ascii)
{
if(ascii > 0 && ascii < 160){ //单字符
return String.valueOf((char)ascii);
}
if(ascii < -20319 || ascii > -10247){ //不知道的字符
return null;
}
Set keySet = spellMap.keySet();
Iterator it = keySet.iterator();
String spell0 = null;;
String spell = null;
int asciiRang0 = -20319;
int asciiRang;
while(it.hasNext()){
spell = (String)it.next();
Object valObj = spellMap.get(spell);
if(valObj instanceof Integer){
asciiRang = ((Integer)valObj).intValue();
if(ascii >= asciiRang0 && ascii < asciiRang){ //区间找到
return(spell0 == null) ? spell : spell0;
}
else{
spell0 = spell;
asciiRang0 = asciiRang;
}
}
}
return null;
}
/**
* 返回字符串的全拼,是汉字转化为全拼,其它字符不进行转换
* @param cnStr String
* 字符串
* @return String
* 转换成全拼后的字符串
*/
public static String getFullSpell(String cnStr)
{
if(null == cnStr || "".equals(cnStr.trim())){
return cnStr;
}
char[] chars = cnStr.toCharArray();
StringBuffer retuBuf = new StringBuffer();
for(int i = 0,Len = chars.length;i < Len;i++){
int ascii = getCnAscii(chars[i]);
if(ascii == 0){ //取ascii时出错
retuBuf.append(chars[i]);
}
else{
String spell = getSpellByAscii(ascii);
if(spell == null){
retuBuf.append(chars[i]);
}
else{
retuBuf.append(spell);
} // end of if spell == null
} // end of if ascii <= -20400
} // end of for
return retuBuf.toString();
}
public static String getFirstSpell(String cnStr)
{
return null;
}
public static void main(String[] args)
{
String str = null;
str = "谢海101普降喜雨";
System.out.println("Spell=" + CnToSpell.getFullSpell(str));
str = "张牙舞爪》。,";
System.out.println("Spell=" + CnToSpell.getFullSpell(str));
str = "李鹏,可耻下场。";
System.out.println("Spell=" + CnToSpell.getFullSpell(str));
str = "猪油,猪八戒。";
System.out.println("Spell=" + CnToSpell.getFullSpell(str));
}
}
posted @
2007-10-09 17:17 I LOVE JAVA 阅读(461) |
评论 (1) |
编辑 收藏