日期:2014-05-16 浏览次数:20311 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<script language="javascript">
function test(obj)
{
var s=obj.value;
s=s.replace(/[^\d\.]/g,"");
s=s.replace(/^(\d*\.\d{0,2}).*$/g,"$1");
while(/\d{4}(\.
------解决方案--------------------
,
------解决方案--------------------
$)/.test(s))
s=s.replace(/(\d)(\d{3}(\.
------解决方案--------------------
,
------解决方案--------------------
$))/,"$1,$2");
obj.value = s;
}
function test2(obj)
{
var s=obj.value;
s=s.replace(/[^\d\.]/g,"");
obj.value = s;
}
</script>
</head>
<body>
<input type="text" id="txtbox" onkeyup="test(this)" onblur="test2(this)"/>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
try {
texts = $("[type='text'][types='int']"); //双属性 选择器
//alert(texts.attr("type"));