<input id="JZMJ" type="text" runat="server" style="width: 100px;" οnkeydοwn="PriceCheckValue(this)" />
<input id="LXDH" type="text" style="width: 100px;" runat="server" οnkeydοwn="CheckValue()" />
文本框中只能输入数字和一个小数点
function PriceCheckValue(objTR)
{
var txtval=objTR.value;
var e = window.event;
var currKey = e.keyCode;
if ((currKey < 48 || currKey > 57) && currKey != 8 && (currKey < 96 || currKey > 105) && (currKey < 37 || currKey > 40) && currKey != 9 && currKey != 13 && currKey != 46 && currKey != 189 && currKey != 109 && currKey != 190 && currKey != 110)
{
e.returnValue = false;
}
else
{
if(currKey==46||currKey==9||currKey== 13||currKey == 46 ||currKey == 189 ||currKey == 109 || currKey== 190 || currKey == 110)
{
if(txtval.indexOf(".") != -1)
e.returnValue = false;
}
}
}
文本框中只能输入数字
function CheckValue(e)
{
var e = window.event;
var currKey = e.keyCode;
if ((currKey < 48 || currKey > 57) && currKey != 8 && (currKey < 96 || currKey > 105) && (currKey < 37 || currKey > 40)&& currKey != 9 )
{
e.returnValue = false;
}
}