過濾數字


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<script language="javascript" type="text/javascript">
function getNum(text){
var value = text.replace(/[^0-9]/ig,""); 
alert(value);
}
</script>
</head>


<body>
<input type="text" id="btn_getNum"/>
<input type="button" value="得到數字" οnclick="getNum(btn_getNum.value);"/>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章