2009年12月15日 星期二

正規表示法
只列出中文或英文


<script language="javascript">
function cheEng(acttype){
if(acttype==0){
document.FORM1.Keyword.value = "要判斷的字".replace(/[ -~]/g,"");//只列出中文
}
if(acttype==1){
document.FORM1.Keyword.value="要判斷的字".replace(/[^a-zA-Z0-9_ ]/g, "");//只列出英文+" "
}
</script>

0 意見:

張貼留言