js

//获得String类型百分数(0.00%)
double percent=count1/Double.valueOf(c1.getString("c_input")).doubleValue();
NumberFormat nt = NumberFormat.getPercentInstance();
nt.setMinimumFractionDigits(2);//保留两位小数
String c_percent=nt.format(percent);
//String 转double
double d=Double.valueOf(c1.getString("c_input")).doubleValue()
//String 转int
int num=Integer.parseInt(s);
//int 转String
String num1=Integer.toString((Integer)listByJDBC1.get(0).get("num"));
 
 
//去重 查询数量
select count(DISTINCT c_customerId)as num from crm_Contract
select distinct bscc_type from bas_commontable_column//去重查询
//复选框
<div class="checkbox">
<label>
<input type="checkbox" id="isAble_1" name="isAble_1" onClick='setCheckBox()'>${uiLabelMap.Open}
</label>
</div>
<input type='hidden' id="c_ex10" name="c_ex10"/>
</td>
 
 
function setCheckBox(){
if($("#isAble_1").prop("checked"))
$("#c_ex10").val("Y");
else
$("#c_ex10").val("N");
}
 
if($("#c_ex10").val()=="Y")
$("#isAble_1").prop("checked",true);
else
$("#isAble_1").prop("checked",false);
 
//复选框
<td colspan='2'>
<input id='pc_ex52_' name='pc_ex52_' value='N' type='checkbox' onClick='setValues(this)' setid='pc_ex52'/><label for="so_ex50_">慈善</label>
<input id='pc_ex52' name='pc_ex52' value='<%=dd.getValue("pc_ex52") %>' type='hidden'/>
</td>
 
function setValues(o){
var setid=$(o).attr("setid");
if($(o).prop("checked")){
$("#"+setid).val("Y");
}else{
$("#"+setid).val("N");
}
}
 
if($("#pc_ex52").val()=="Y")
$("#pc_ex52_").prop("checked",true);
//输入数字 小数
<td >
<input class="form-control" id="c_ex9" name="c_ex9" onchange="fixNumber(this,2,true)" style='100%'/>
</td>
 
//控制输入数字 小数点 onchange="fixNumber(this,2,true)"
function fixNumber(o,n,b){
if(typeof(o)=="string"){
o=document.getElementById(o);
}
if(typeof(n)=="string"){
n=Number($("#"+n).val());
};
if(o.value==""||isNaN(o.value)||o.value==Infinity){
o.value=parseFloat("0").toFixed(n);
}else{
o.value=parseFloat(o.value).toFixed(n);
}
if(b!=null&&b==true){
if(Number(o.value)==0){
o.value="";
}
}
}
 
 
//js 保留两位小数
function returnFloat(value){//保留两位小数
var value=Math.round(parseFloat(value)*100)/100;
var xsd=value.toString().split(".");
if(xsd.length==1){
value=value.toString()+".00";
return value;
}
if(xsd.length>1){
if(xsd[1].length<2){
value=value.toString()+"0";
}
return value;
}
}
 
// replace(c_ex46,char(10),',') 把 换行 换成 逗号 sql语句
select ','+replace(c_ex46,char(10),',')+',' from t_nowinv
where ','+replace(c_ex46,char(10),',')+',' like '%,4H0919275,%'
 
order by c_ex46 asc
 
//年月日
$("#c_dat5").val(unescape(sui.info[0].c_dat5).substring(0,10));
//年月日 时分
$("#c_dat5").val(unescape(sui.info[0].c_dat5).substring(0,10));
 
 
原文地址:https://www.cnblogs.com/leo0705/p/8473124.html