<cfoutput>
<script type="text/javascript教程">
<!--
function BASEisNotNum(theNum)
{
判斷是否為數字
if (BASEtrim(theNum)=="")
return true;
for(var i=0;i<theNum.length;i++){
oneNum=theNum.substring(i,i+1);
if (oneNum<"0" || oneNum>"9")
return true;
}
return false;
}
function BASEisNotInt(theInt)
{
判斷是否為整數
theInt=BASEtrim(theInt);
if ((theInt.length>1 && theInt.substring(0,1)=="0") || BASEisNotNum(theInt)){
return true;
}
return false;
}
function BASEisNotFloat(theFloat)
{
//判斷是否為浮點數
len=theFloat.length;
dotNum=0;
if (len==0)
return true;
for(var i=0;i<len;i++){
oneNum=theFloat.substring(i,i+1);
if (oneNum==".")
dotNum++;
if (((oneNum<"0" || oneNum>"9") && oneNum!=".") || dotNum>1)
return true;
}
if (len>1 && theFloat.substring(0,1)=="0"){
if (theFloat.substring(1,2)!=".")
return true;
}
return false;
}
function BASEtrim(str)
{
去掉空格
lIdx=0;rIdx=str.length;
if (BASEtrim.arguments.length==2)
act=BASEtrim.arguments[1].toLowerCase();
else
act="all";
for(var i=0;i<str.length;i++){
thelStr=str.substring(lIdx,lIdx+1);
therStr=str.substring(rIdx,rIdx-1);
if ((act=="all" || act=="left") && thelStr==" "){
lIdx++;
}
if ((act=="all" || act=="right") && therStr==" "){
rIdx--;
}
}
str=str.slice(lIdx,rIdx);
return str;
}
-->
</script>
</cfoutput>