一段用于编辑页面表单并使用ajax提交与无刷新获取的js段落
usingNamespace("CiCeng.Address")["ShippingAddressInfo"] = {
ShippingAddressManager: function() {
this.CurrentEditAreaData = '';
this.CurrentElementContent = '';
this.CurrentEditAreaInnerHtml = '';
var this_reference = this;
this.SubmitCallHandler = function() {
this_reference.InvokeSubmitDelegateFunction.call(this_reference);
}
this.CancelCallHandler = function() {
this_reference.InvokeCancelDelegateFunction.call(this_reference);
}
this.InvokeSubmitDelegateFunction = function() {
var jqueryObj = this.CurrentElementContent;
var oldData = this.CurrentEditAreaData;
var newData = CiCeng.Address.ShippingAddressInfo.init(jqueryObj);
if (newData == null) { return; }
if (!this.Compared(oldData, newData)) {
var submitObj = jqueryObj.parent().find('.bottomarea')[0];
CiCeng.Address.ShippingAddressInfo.post(jqueryObj, newData, 1, submitObj);
}
else {
alert($Resource.BuildContent("CiCengCenter_ModifyShippingAddress_NoInfoEdit"));
}
}
this.InvokeCancelDelegateFunction = function() {
var jqueryObj = this.CurrentElementContent;
var innerHTML = this.CurrentEditAreaInnerHtml;
jqueryObj.empty().append(innerHTML);
}
this.Compared = function(oldData, newData) {
if (oldData.AddressTitle == newData.AddressTitle
&& oldData.IsDefault == newData.IsDefault
//&& oldData.Name == newData.Name
&& oldData.Contact == newData.Contact
&& oldData.CellPhone == newData.CellPhone
&& oldData.Phone == newData.Phone
&& oldData.AddressAreaID == newData.AddressAreaID
&& oldData.Address == newData.Address
&& oldData.Zip == newData.Zip
&& oldData.Fax == newData.Fax
&& oldData.IDCardType == newData.IDCardType
&& oldData.IDCardNo == newData.IDCardNo) {
return true;
}
return false;
}
},
getCurrentData: function(jqueryObj, hasValidated, actionType) {
var addressShortName = jqueryObj.find('#addressShort');
var isDefaultAddress = jqueryObj.find('#defaultAddress')[0].checked;
//var invoiceTitle = jqueryObj.find('#invoiceTitle');
var contactMan = jqueryObj.find('#contactMan');
var cellPhone = jqueryObj.find('#mobile')
var phone = jqueryObj.find('#tel');
var systemAreaID = jqueryObj.find('#area')
var address = jqueryObj.find('#address');
var zip = jqueryObj.find('#zip');
var fax = jqueryObj.find('#fax');
var id = jqueryObj.find('#txtShippingAddressID');
var area = jqueryObj.find("select[name=area]");
var idCardType = jqueryObj.find('#idCardType');
var idCardNo = jqueryObj.find('#idCardNo');
if (hasValidated) {
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(addressShortName, 'CiCengCenter_ModifyShippingAddress_AddressTitleDesc');
if ($String.Trim(addressShortName.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(addressShortName, 'CiCengCenter_ModifyShippingAddress_AddressTitleDesc', 'CiCengCenter_ModifyShippingAddress_AddressError');
addressShortName.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(contactMan, 'CiCengCenter_ModifyShippingAddress_ReceiveContactDesc');
if ($String.Trim(contactMan.val()) == "") {
CiCeng.Common.ValidateHelper.warningMessageForShippingAddress(contactMan, 'CiCengCenter_ModifyShippingAddress_ReceiveContactDesc');
contactMan.focus();
return null;
}
else if ($String.Trim(contactMan.val()).length > 20) {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(contactMan, 'CiCengCenter_ModifyShippingAddress_ReceiveContactDesc', 'CiCengCenter_ModifyShippingAddress_ReceiveNameDesc');
contactMan.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(cellPhone, 'CiCengCenter_ModifyShippingAddress_ReceiveCellPhoneDesc');
if ($String.Trim(cellPhone.val()) != "") {
if (!Biz.Common.Validation.isMobile($String.Trim(cellPhone.val()))) {
CiCeng.Common.ValidateHelper.validateStringValueForCellPhone(cellPhone, 'CiCengCenter_ModifyShippingAddress_ReceiveCellPhoneDesc', 'CiCengCenter_ModifyShippingAddress_ReceiveCellPhoneFormatError');
cellPhone.focus();
return null;
}
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(phone, 'CiCengCenter_ModifyShippingAddress_ReceivePhoneDesc');
if ($String.Trim(phone.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(phone, 'CiCengCenter_ModifyShippingAddress_ReceivePhoneDesc', 'CiCengCenter_ModifyShippingAddress_ReceivePhoneDescWarning');
phone.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessage(area);
if (area[0].options.selectedIndex == 0) {
CiCeng.Common.ValidateHelper.areaWarningMessage(area, 'CiCengCenter_ModifyShippingAddress_AreaError')
area.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(address, 'CiCengCenter_ModifyShippingAddress_ReceiveAddressDesc');
if ($String.Trim(address.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(address, 'CiCengCenter_ModifyShippingAddress_ReceiveAddressDesc', 'CiCengCenter_ModifyShippingAddress_ReceiveAddressDesc');
address.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(zip, 'CiCengCenter_ModifyShippingAddress_ZipDesc');
if ($String.Trim(zip.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(zip, 'CiCengCenter_ModifyShippingAddress_ZipDesc', 'CiCengCenter_ModifyShippingAddress_ZipDesc');
zip.focus();
return null;
}
else if (!Biz.Common.Validation.isZip($String.Trim(zip.val()))) {
CiCeng.Common.ValidateHelper.warningMessageForPersonalInfo(zip, 'CiCengCenter_ModifyShippingAddress_ZipDesc');
zip.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForCustomerContactInfo(idCardNo, 'AccountCenter_ModifyTravelerInfo_NeedIDCardNODesc');
if ($String.Trim(idCardNo.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(idCardNo, 'AccountCenter_ModifyTravelerInfo_NeedIDCardNODesc', 'AccountCenter_ModifyTravelerInfo_NeedIDCardNODesc');
idCardNo.focus();
return null;
}
}
var shippingAddress = {
IDCardType: idCardType.val(),
IDCardNo: $String.Trim(idCardNo.val()),
AddressTitle: $String.Trim(addressShortName.val()),
IsDefault: isDefaultAddress,
//Name: $String.Trim(invoiceTitle.val()),
Contact: $String.Trim(contactMan.val()),
CellPhone: $String.Trim(cellPhone.val()),
Phone: $String.Trim(phone.val()),
AddressAreaID: $String.Trim(systemAreaID.val()),
Address: $String.Trim(address.val()),
Zip: $String.Trim(zip.val()),
Fax: $String.Trim(fax.val()),
ID: $String.Trim(id.val())
};
return shippingAddress;
},
init: function(jqueryObj, actionType) {
return CiCeng.Address.ShippingAddressInfo.getCurrentData(jqueryObj, true, actionType);
},
clearCreateControlArea: function() {
var count = $('.mt10.boxD .boxbody.cls').length;
if (count > 0 && count < 5) {
var jqueryObj = $($('.mt10.boxD .boxbody.cls')[count - 1]);
CiCeng.Address.ShippingAddressInfo.clear(jqueryObj);
}
},
clearValue: function(obj) {
var jqueryObj = $($(obj).parent().parent().find('.boxbody.cls')[0]);
CiCeng.Address.ShippingAddressInfo.clear(jqueryObj);
},
clear: function(jqueryObj) {
jqueryObj.find('#idCardType').val('0');
jqueryObj.find('#idCardNo').val('');
jqueryObj.find('#addressShort').val('');
jqueryObj.find('#defaultAddress').attr('checked', '');
//jqueryObj.find('#invoiceTitle').val('');
jqueryObj.find('#contactMan').val('');
jqueryObj.find('#mobile').val('');
jqueryObj.find('#tel').val('');
jqueryObj.find('#region')[0].selectedIndex = 0;
var city = jqueryObj.find('#city')[0];
var text = city.options[0].text;
city.options.length = 0;
city.options.add(new Option(text, "-1"));
var area = jqueryObj.find('#area')[0];
text = area.options[0].text;
area.options.length = 0;
area.options.add(new Option(text, "-1"));
jqueryObj.find('#address').val('');
jqueryObj.find('#zip').val('');
jqueryObj.find('#fax').val('');
},
post: function(jqueryObj, addressAreaInfo, actionType, obj) {
var strAreaInfo = $Json.ToJson(addressAreaInfo);
$.ajax({
type: "post",
dataType: "html",
url: $Url.BuildCurrentUrl("Ajax/Customer/AjaxShippingInfo.aspx"),
timeout: 30000,
data: { Action: actionType, Data: escape(strAreaInfo) },
cache: false,
global: true,
beforeSend: function(XMLHttpRequest) {
if (actionType == 2) {
//Biz.Common.Loading.show($(obj));
}
else {
Biz.Common.Loading.showForRemoveElement($(obj));
}
},
success: function(data, textStatus) {
//Process result data
CiCeng.Address.ShippingAddressInfo.proccessed(jqueryObj, data);
},
complete: function(XMLHttpRequest, textStatus) {
Biz.Common.Loading.removeLoadingForShowElement($(obj));
},
error: function() {
Biz.Common.PromptText.systemError();
}
});
},
proccessed: function(jqueryObj, result) {
$('.box_wrap').empty().append(result);
var str = $('#ShippingInfoResult').text();
if (str.length > 0)
alert(str);
else
alert($Resource.BuildContent("CiCengCenter_ModifyShippingAddress_OperationSuccess"));
},
submit: function(obj, actionType) {
var jqueryObj = $($(obj).parent().parent().find('.boxbody.cls')[0]);
var processobj = $(obj).parent().parent().find('.bottomarea')[0];
var addressAreaInfo = CiCeng.Address.ShippingAddressInfo.init(jqueryObj, actionType);
if (addressAreaInfo == null) return;
CiCeng.Address.ShippingAddressInfo.post(jqueryObj, addressAreaInfo, actionType, processobj);
},
addAddress: function(obj) {
CiCeng.Address.ShippingAddressInfo.submit(obj, 0);
},
editAddress: function(callbackFunction) {
if ($.isFunction(callbackFunction)) callbackFunction.call($);
},
deleteAddress: function(obj) {
if (confirm($Resource.BuildContent("CiCengCenter_ModifyShippingAddress_ComfirmDelete"))) {
var jqueryObj = $($(obj).parent().parent().next("div")); //find('.boxbody.cls')[0]
var addressAreaInfo = CiCeng.Address.ShippingAddressInfo.getCurrentData(jqueryObj, false);
CiCeng.Address.ShippingAddressInfo.post(jqueryObj, addressAreaInfo, 2, obj);
}
},
CanelEdit: function(obj) {
var jqueryObj = $(obj).parent().parent();
var newObj = jqueryObj.prev("div");
newObj.slideDown("fast");
jqueryObj.hide();
jqueryObj.find('.bottomarea #clearAll')[0].onclick();
},
showEdit: function(obj, b) {
if (b) {
var jqueryObj = $(obj).parent().parent();
var newObj = jqueryObj.next("div");
newObj.slideDown("fast");
jqueryObj.hide();
newObj.find('.bottomarea #submit').each(function(index, item) {
var addressManager = new CiCeng.Address.ShippingAddressInfo.ShippingAddressManager();
var editAreaJQueryObj = $($(item).parent().parent().find('.boxbody.cls')[0]);
addressManager.CurrentElementContent = editAreaJQueryObj;
addressManager.CurrentEditAreaData = CiCeng.Address.ShippingAddressInfo.getCurrentData(editAreaJQueryObj, false);
item.onclick = function() {
CiCeng.Address.ShippingAddressInfo.editAddress(addressManager.SubmitCallHandler);
};
});
newObj.find('.bottomarea #clearAll').each(function(index, item) {
var addressManager = new CiCeng.Address.ShippingAddressInfo.ShippingAddressManager();
var editAreaJQueryObj = $($(item).parent().prev("div")[0]); //parent().find('.boxbody.cls')[0]
addressManager.CurrentElementContent = editAreaJQueryObj;
addressManager.CurrentEditAreaInnerHtml = editAreaJQueryObj[0].innerHTML;
item.onclick = function() {
CiCeng.Address.ShippingAddressInfo.editAddress(addressManager.CancelCallHandler);
};
});
}
else {
var jqueryObj = $(obj).parent().parent();
var preObj = jqueryObj.prev("div");
preObj.slideDown("fast");
jqueryObj.hide();
jqueryObj.find('.bottomarea #clearAll')[0].onclick();
}
}
};
ShippingAddressManager: function() {
this.CurrentEditAreaData = '';
this.CurrentElementContent = '';
this.CurrentEditAreaInnerHtml = '';
var this_reference = this;
this.SubmitCallHandler = function() {
this_reference.InvokeSubmitDelegateFunction.call(this_reference);
}
this.CancelCallHandler = function() {
this_reference.InvokeCancelDelegateFunction.call(this_reference);
}
this.InvokeSubmitDelegateFunction = function() {
var jqueryObj = this.CurrentElementContent;
var oldData = this.CurrentEditAreaData;
var newData = CiCeng.Address.ShippingAddressInfo.init(jqueryObj);
if (newData == null) { return; }
if (!this.Compared(oldData, newData)) {
var submitObj = jqueryObj.parent().find('.bottomarea')[0];
CiCeng.Address.ShippingAddressInfo.post(jqueryObj, newData, 1, submitObj);
}
else {
alert($Resource.BuildContent("CiCengCenter_ModifyShippingAddress_NoInfoEdit"));
}
}
this.InvokeCancelDelegateFunction = function() {
var jqueryObj = this.CurrentElementContent;
var innerHTML = this.CurrentEditAreaInnerHtml;
jqueryObj.empty().append(innerHTML);
}
this.Compared = function(oldData, newData) {
if (oldData.AddressTitle == newData.AddressTitle
&& oldData.IsDefault == newData.IsDefault
//&& oldData.Name == newData.Name
&& oldData.Contact == newData.Contact
&& oldData.CellPhone == newData.CellPhone
&& oldData.Phone == newData.Phone
&& oldData.AddressAreaID == newData.AddressAreaID
&& oldData.Address == newData.Address
&& oldData.Zip == newData.Zip
&& oldData.Fax == newData.Fax
&& oldData.IDCardType == newData.IDCardType
&& oldData.IDCardNo == newData.IDCardNo) {
return true;
}
return false;
}
},
getCurrentData: function(jqueryObj, hasValidated, actionType) {
var addressShortName = jqueryObj.find('#addressShort');
var isDefaultAddress = jqueryObj.find('#defaultAddress')[0].checked;
//var invoiceTitle = jqueryObj.find('#invoiceTitle');
var contactMan = jqueryObj.find('#contactMan');
var cellPhone = jqueryObj.find('#mobile')
var phone = jqueryObj.find('#tel');
var systemAreaID = jqueryObj.find('#area')
var address = jqueryObj.find('#address');
var zip = jqueryObj.find('#zip');
var fax = jqueryObj.find('#fax');
var id = jqueryObj.find('#txtShippingAddressID');
var area = jqueryObj.find("select[name=area]");
var idCardType = jqueryObj.find('#idCardType');
var idCardNo = jqueryObj.find('#idCardNo');
if (hasValidated) {
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(addressShortName, 'CiCengCenter_ModifyShippingAddress_AddressTitleDesc');
if ($String.Trim(addressShortName.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(addressShortName, 'CiCengCenter_ModifyShippingAddress_AddressTitleDesc', 'CiCengCenter_ModifyShippingAddress_AddressError');
addressShortName.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(contactMan, 'CiCengCenter_ModifyShippingAddress_ReceiveContactDesc');
if ($String.Trim(contactMan.val()) == "") {
CiCeng.Common.ValidateHelper.warningMessageForShippingAddress(contactMan, 'CiCengCenter_ModifyShippingAddress_ReceiveContactDesc');
contactMan.focus();
return null;
}
else if ($String.Trim(contactMan.val()).length > 20) {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(contactMan, 'CiCengCenter_ModifyShippingAddress_ReceiveContactDesc', 'CiCengCenter_ModifyShippingAddress_ReceiveNameDesc');
contactMan.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(cellPhone, 'CiCengCenter_ModifyShippingAddress_ReceiveCellPhoneDesc');
if ($String.Trim(cellPhone.val()) != "") {
if (!Biz.Common.Validation.isMobile($String.Trim(cellPhone.val()))) {
CiCeng.Common.ValidateHelper.validateStringValueForCellPhone(cellPhone, 'CiCengCenter_ModifyShippingAddress_ReceiveCellPhoneDesc', 'CiCengCenter_ModifyShippingAddress_ReceiveCellPhoneFormatError');
cellPhone.focus();
return null;
}
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(phone, 'CiCengCenter_ModifyShippingAddress_ReceivePhoneDesc');
if ($String.Trim(phone.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(phone, 'CiCengCenter_ModifyShippingAddress_ReceivePhoneDesc', 'CiCengCenter_ModifyShippingAddress_ReceivePhoneDescWarning');
phone.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessage(area);
if (area[0].options.selectedIndex == 0) {
CiCeng.Common.ValidateHelper.areaWarningMessage(area, 'CiCengCenter_ModifyShippingAddress_AreaError')
area.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(address, 'CiCengCenter_ModifyShippingAddress_ReceiveAddressDesc');
if ($String.Trim(address.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(address, 'CiCengCenter_ModifyShippingAddress_ReceiveAddressDesc', 'CiCengCenter_ModifyShippingAddress_ReceiveAddressDesc');
address.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForShippingAddress(zip, 'CiCengCenter_ModifyShippingAddress_ZipDesc');
if ($String.Trim(zip.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(zip, 'CiCengCenter_ModifyShippingAddress_ZipDesc', 'CiCengCenter_ModifyShippingAddress_ZipDesc');
zip.focus();
return null;
}
else if (!Biz.Common.Validation.isZip($String.Trim(zip.val()))) {
CiCeng.Common.ValidateHelper.warningMessageForPersonalInfo(zip, 'CiCengCenter_ModifyShippingAddress_ZipDesc');
zip.focus();
return null;
}
CiCeng.Common.ValidateHelper.clearMessageForCustomerContactInfo(idCardNo, 'AccountCenter_ModifyTravelerInfo_NeedIDCardNODesc');
if ($String.Trim(idCardNo.val()) == "") {
CiCeng.Common.ValidateHelper.validateStringValueForShippingAddress(idCardNo, 'AccountCenter_ModifyTravelerInfo_NeedIDCardNODesc', 'AccountCenter_ModifyTravelerInfo_NeedIDCardNODesc');
idCardNo.focus();
return null;
}
}
var shippingAddress = {
IDCardType: idCardType.val(),
IDCardNo: $String.Trim(idCardNo.val()),
AddressTitle: $String.Trim(addressShortName.val()),
IsDefault: isDefaultAddress,
//Name: $String.Trim(invoiceTitle.val()),
Contact: $String.Trim(contactMan.val()),
CellPhone: $String.Trim(cellPhone.val()),
Phone: $String.Trim(phone.val()),
AddressAreaID: $String.Trim(systemAreaID.val()),
Address: $String.Trim(address.val()),
Zip: $String.Trim(zip.val()),
Fax: $String.Trim(fax.val()),
ID: $String.Trim(id.val())
};
return shippingAddress;
},
init: function(jqueryObj, actionType) {
return CiCeng.Address.ShippingAddressInfo.getCurrentData(jqueryObj, true, actionType);
},
clearCreateControlArea: function() {
var count = $('.mt10.boxD .boxbody.cls').length;
if (count > 0 && count < 5) {
var jqueryObj = $($('.mt10.boxD .boxbody.cls')[count - 1]);
CiCeng.Address.ShippingAddressInfo.clear(jqueryObj);
}
},
clearValue: function(obj) {
var jqueryObj = $($(obj).parent().parent().find('.boxbody.cls')[0]);
CiCeng.Address.ShippingAddressInfo.clear(jqueryObj);
},
clear: function(jqueryObj) {
jqueryObj.find('#idCardType').val('0');
jqueryObj.find('#idCardNo').val('');
jqueryObj.find('#addressShort').val('');
jqueryObj.find('#defaultAddress').attr('checked', '');
//jqueryObj.find('#invoiceTitle').val('');
jqueryObj.find('#contactMan').val('');
jqueryObj.find('#mobile').val('');
jqueryObj.find('#tel').val('');
jqueryObj.find('#region')[0].selectedIndex = 0;
var city = jqueryObj.find('#city')[0];
var text = city.options[0].text;
city.options.length = 0;
city.options.add(new Option(text, "-1"));
var area = jqueryObj.find('#area')[0];
text = area.options[0].text;
area.options.length = 0;
area.options.add(new Option(text, "-1"));
jqueryObj.find('#address').val('');
jqueryObj.find('#zip').val('');
jqueryObj.find('#fax').val('');
},
post: function(jqueryObj, addressAreaInfo, actionType, obj) {
var strAreaInfo = $Json.ToJson(addressAreaInfo);
$.ajax({
type: "post",
dataType: "html",
url: $Url.BuildCurrentUrl("Ajax/Customer/AjaxShippingInfo.aspx"),
timeout: 30000,
data: { Action: actionType, Data: escape(strAreaInfo) },
cache: false,
global: true,
beforeSend: function(XMLHttpRequest) {
if (actionType == 2) {
//Biz.Common.Loading.show($(obj));
}
else {
Biz.Common.Loading.showForRemoveElement($(obj));
}
},
success: function(data, textStatus) {
//Process result data
CiCeng.Address.ShippingAddressInfo.proccessed(jqueryObj, data);
},
complete: function(XMLHttpRequest, textStatus) {
Biz.Common.Loading.removeLoadingForShowElement($(obj));
},
error: function() {
Biz.Common.PromptText.systemError();
}
});
},
proccessed: function(jqueryObj, result) {
$('.box_wrap').empty().append(result);
var str = $('#ShippingInfoResult').text();
if (str.length > 0)
alert(str);
else
alert($Resource.BuildContent("CiCengCenter_ModifyShippingAddress_OperationSuccess"));
},
submit: function(obj, actionType) {
var jqueryObj = $($(obj).parent().parent().find('.boxbody.cls')[0]);
var processobj = $(obj).parent().parent().find('.bottomarea')[0];
var addressAreaInfo = CiCeng.Address.ShippingAddressInfo.init(jqueryObj, actionType);
if (addressAreaInfo == null) return;
CiCeng.Address.ShippingAddressInfo.post(jqueryObj, addressAreaInfo, actionType, processobj);
},
addAddress: function(obj) {
CiCeng.Address.ShippingAddressInfo.submit(obj, 0);
},
editAddress: function(callbackFunction) {
if ($.isFunction(callbackFunction)) callbackFunction.call($);
},
deleteAddress: function(obj) {
if (confirm($Resource.BuildContent("CiCengCenter_ModifyShippingAddress_ComfirmDelete"))) {
var jqueryObj = $($(obj).parent().parent().next("div")); //find('.boxbody.cls')[0]
var addressAreaInfo = CiCeng.Address.ShippingAddressInfo.getCurrentData(jqueryObj, false);
CiCeng.Address.ShippingAddressInfo.post(jqueryObj, addressAreaInfo, 2, obj);
}
},
CanelEdit: function(obj) {
var jqueryObj = $(obj).parent().parent();
var newObj = jqueryObj.prev("div");
newObj.slideDown("fast");
jqueryObj.hide();
jqueryObj.find('.bottomarea #clearAll')[0].onclick();
},
showEdit: function(obj, b) {
if (b) {
var jqueryObj = $(obj).parent().parent();
var newObj = jqueryObj.next("div");
newObj.slideDown("fast");
jqueryObj.hide();
newObj.find('.bottomarea #submit').each(function(index, item) {
var addressManager = new CiCeng.Address.ShippingAddressInfo.ShippingAddressManager();
var editAreaJQueryObj = $($(item).parent().parent().find('.boxbody.cls')[0]);
addressManager.CurrentElementContent = editAreaJQueryObj;
addressManager.CurrentEditAreaData = CiCeng.Address.ShippingAddressInfo.getCurrentData(editAreaJQueryObj, false);
item.onclick = function() {
CiCeng.Address.ShippingAddressInfo.editAddress(addressManager.SubmitCallHandler);
};
});
newObj.find('.bottomarea #clearAll').each(function(index, item) {
var addressManager = new CiCeng.Address.ShippingAddressInfo.ShippingAddressManager();
var editAreaJQueryObj = $($(item).parent().prev("div")[0]); //parent().find('.boxbody.cls')[0]
addressManager.CurrentElementContent = editAreaJQueryObj;
addressManager.CurrentEditAreaInnerHtml = editAreaJQueryObj[0].innerHTML;
item.onclick = function() {
CiCeng.Address.ShippingAddressInfo.editAddress(addressManager.CancelCallHandler);
};
});
}
else {
var jqueryObj = $(obj).parent().parent();
var preObj = jqueryObj.prev("div");
preObj.slideDown("fast");
jqueryObj.hide();
jqueryObj.find('.bottomarea #clearAll')[0].onclick();
}
}
};
作者:Bober Song
出处:http://bober.cnblogs.com/
CARE健康网: http://www.aicareyou.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://bober.cnblogs.com/
CARE健康网: http://www.aicareyou.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。