日期:2014-05-16  浏览次数:20328 次

js tools(2)

?

/**

?*?

?* @param divId

?* ? ? ? ? ? ?one container

?* @param info

?* ? ? ? ? ? ?operation result message to show in the up DIV, such as: "Add

?* ? ? ? ? ? ?Successfully!"

?* @param isSuccess

?* ? ? ? ? ? ?one sign whether operate successfully.Just two values:true or

?* ? ? ? ? ? ?false.true means success.

?* @returns undefined

?*/

function showOperationResultInfo(divId,info,isSuccess){

$("#"+divId).removeAttr("style");

if(isSuccess){

$("#"+divId).attr("style","color:green");

}else{

$("#"+divId).attr("style","color:red");

}

$("#"+divId).empty();

$("#"+divId).html(info);

}

?

/**

?* @param url

?* ? ? ? ? ? ?format must be xxx.action?eventName=

?* @param params

?* ? ? ? ? ? ?format must consist of "key=value",such as deleteId=10

?* @param doDeleteCallback

?* ? ? ? ? ? ?do works after servers response

?* @param validateFun

?* ? ? ? ? ? ?do validation before submitting deletion request

?* @param deleteNoteMess

?* ? ? ? ? ? ?popup warning information. if not passing,to use default value

?* @returns {Boolean} whether this function operates successfully or not

?

?*?

?* How to use: commonDeleteEntireObjectFun(URL.deleteInstance,"id=3",deleteCallback,deleteValidationFun);

?* function deleteCallback(data){

var flag = isSuccessRetun(data);

if(flag){

location.href=URL.loadInstanceListPage;

}else{

toShowResponseResMessWithoutParsingData("operationTipMess","operationTipMess_error",data);

}

}

?*?

?* function deleteValidationFun(params)

{

return commonValidateFun(URL.validateInstanceUsed,params);