js实现在字符串中提取数字

时间:2013-11-05    点击:136   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js实现在字符串中提取数字</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="得到数字" onclick="getNum(btn_getNum.value);"/>
</body>
</html>

jquery按回车提交数据的代码示例
js jq 单击和双击区分示例介绍
jquery如何判断某元素是否具备指定的样式
使用js声明数组,对象在jsp页面中(获得ajax得到json数据)
js截取字符串的两种方法及区别详解
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved