复制代码 代码如下:
<script type="text/javascript">
var db = "0.123456789";//原数值
var num = 5;//小数点后位数
var re = new RegExp("\d+\.\d{" + num + "}","gm");
alert(db.match(re));
</script></td>
</tr>
</table>
时间: 2024-11-02 21:52:04
复制代码 代码如下:
<script type="text/javascript">
var db = "0.123456789";//原数值
var num = 5;//小数点后位数
var re = new RegExp("\d+\.\d{" + num + "}","gm");
alert(db.match(re));
</script></td>
</tr>
</table>