////////////以下代码是可以运行的 属于jsp文件
<%@ page language= "java " contentType= "text/html; charset=UTF-8 " pageEncoding= "GBK "%>
<html>
<head>
<title> 枚举字符串 </title>
<script language= "javascript " type= "text/javascript " src= "Textlimit.js " >
</script>
<script language= "JavaScript ">
var tt; //输出计数
var s=1; //增加计数
var u=1; //检查计数
var n;
var intRowIndex = 0;
arrcat =new Array(); //最终返回的全部结果数组
arrsub =new Array(); //检查错误的数组
//值检查
function JHshLTrim(sString)
{
var sStr,i,iStart,sResult = " ";
sStr = sString.split( " ");
iStart = -1 ;
for (i = 0 ; i < sStr.length ; i++)
{
if (sStr[i] != " ")
{
iStart = i;
break;
}
}
if (iStart == -1) { return " " ;} //表示sString中的所有字符均是空格,则返回空串
else { return sString.substring(iStart) ;}
}
function check(tbIndex)
{
if(JHshLTrim(document.getElementById( 'myCell1 ').value)== " ")
{
alert( "显示名不能为空! ");
return false;
}
if(JHshLTrim(document.getElementById( 'myCell2 ').value)== " ")
{
alert( "参数值不能为空! ");
return false;
}
if(JHshLTrim(document.getElementById( 'myCell3 ').value)== " ")
{
alert( "描述不能为空! ");
return false;
}
if(document.getElementById( 'myCell2 ').value!= " ")
{
for(u=1;u <=s;u++)
{
if(arrcat[u*3-1]==document.getElementById( 'myCell2 ').value)
{
(document.getElementById( 'myCell2 ').value+ " 已经存在 ");
return false;
}
else
{
}
}
insertRow(tbIndex);
}
}
function insertRow(tbIndex)
{
var objRow = myTable.insertRow(tbIndex);
var objCel = objRow.insertCell(0);
objCel.innerHTML = " <input type=checkbox onclick= 'getIndex() ' /> ";
var objCel = objRow.insertCell(1);
objCel.innerHTML=document.myForm.myCell1.value;
var objCel = objRow.insertCell(2);
objCel.innerHTML=document.myForm.myCell2.value;
var objCel = objRow.insertCell(3);