[置顶] 向上取小数两位且仅限数字及小数点


function getPrice(sender){
 value = $(sender).val();
 value = Math.ceil(value*100)/100;
 if(!isNaN(value)){
  $(sender).val(value);
 }else{
  $(sender).val("");
  alert("请输入正确的数字!");  
 }
}

 


    <input type=text name="price" title="price" value="<%=Str4Html(sPrice)%>" class=gridtextbox
     onkeypress="var k=event.keyCode; return k>=48&&k<=57||k==46"
      onpaste="return !clipboardData.getData('text').match(/\D/)"
      ondragenter="return false" style="ime-mode:Disabled"
     onchange="getPrice(this)">

你可能感兴趣的:(html,function,Class,input)