close

// 中文驗證
function isChinese ( str ) {
var regx = /[^\u4e00-\u9fa5]/;
if ( regx.test( str ) ){
return false;
} else {
return true;
}
}


//按鈕事件綁定
$('#cht-button').on('click', function(){
alert( isChinese ($('#cht-text').val() ) );
});
$('#eng-button').on('click', function(){
alert( isChinese ($('#eng-text').val() ) );
});

 

http://jsfiddle.net/dNVDV/5/

http://seanlin0324.blogspot.tw/2012/08/javascript.html

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 amychang2014 的頭像
    amychang2014

    工作需要筆記

    amychang2014 發表在 痞客邦 留言(0) 人氣()