js控制双击修改内容

来源:互联网 发布:剑网3炮姐捏脸数据 编辑:程序博客网 时间:2024/06/05 19:48
function modify_point(station_id,station_name,origion_point,obj){
//检测小数点后有六位的数字
var pat="(^[1-9]{1}[0-9]{0,8}(\\.[0-9]{1,6}){0,1}$)|(^0\\.[0-9]{1,6}$)|(^0$)";
var patrn = new RegExp(pat,"g");
var new_point = $(obj).val().trim() + "";
if(!patrn.test(new_point)){
alert("您输入的计分规则不符合要求,请输入最多六位小数的数字");
$(obj).parent().html(origion_point);
}else if(origion_point != new_point){
var msg = "确定要将计分由"+origion_point+"修改为"+new_point+"吗?";
jconfirm("计分修改", msg,station_id,station_name,origion_point,new_point,obj);
}else{
$(obj).parent().html($(obj).val());
}
  $(dbclick_flag).val("OK");
}


function point_edit(station_id,station_name,obj){
if($(dbclick_flag).val() == "OK"){
$(dbclick_flag).val("NO");
  var origion_point = String($(obj).html());
    $(obj).html("<input type='text' size=8 id ='new_point' value = \"" + origion_point +"\" onblur='modify_point(\""+station_id+"\",\""+station_name+"\",\""+origion_point+"\",this)'>");
    $('#new_point').focus();    
}
}


function jconfirm(title, msg,station_id,station_name,origion_point,new_point,obj) {
$("#hint").text(msg);
$("#hint").dialog({
dialogClass: "my-dialog",
autoOpen : true,
modal : true,
width : 550,
show: {
effect: "clip",
duration: 400
},
hide: {
effect: "fold",
duration: 400
},
title : title,
buttons: {
" 确 认 ": function() {
$(obj).parent().html(String($(obj).val()));
window.location.href = 'workload_point_setting.php?act=modify_point&station_id=' + station_id + '&new_point=' + new_point + '&station_name=' + station_name;
$( this ).dialog( "close" );
},
" 取 消 ": function() {
$(obj).parent().html(origion_point);
$( this ).dialog( "close" );
}
}
});
}
0 0
原创粉丝点击