📄 jitk_addresources.js
字号:
var JitkAddResources = new function() {
var setInit = false;
this.init = function(){
//register postback tag handler
EsriControls.addPostBackTagHandler("jitk-resource-response", JitkAddResources.tagHandler)
}
/* Process postback xml response and update content */
this.tagHandler = function(xml, eventSources) {
//update elements on page with values
if (!xml) return;
alert(xml.getElementsByTagName("jitk-error-url").item(0).firstChild.nodeValue);
}
this.setResources = function(mapId, resources, zval){
if (!resources || resources == 'null') return;
var zoom = true;
if (zval && zval.toLowerCase() == 'false') zoom = false;
if (!setInit) this.init();
var map = EsriControls.maps[mapId];
var formId = map.formId;
var url = EsriUtils.getServerUrl(formId);
//set required param id
var required_param = "addResources";
//build request params
var params = encodeURIComponent(required_param) + "=" + encodeURIComponent(required_param) + "&mapId=" + encodeURIComponent(mapId) + "&formId=" + encodeURIComponent(formId) + "&";
params += "resources=" + encodeURIComponent(resources);
params += "&zoom=" + encodeURIComponent(zoom);
//add request param for all form fields in argument form
params += (params.endsWith("&") ? "" : "&") + EsriUtils.buildRequestParams(formId);
//show loading image
map.showLoading();
//send ajax request and pass EsriControls.processPostBack function to process response
var xh = EsriUtils.sendAjaxRequest(url, params, false, function() { EsriControls.processPostBack(xh); });
}
var self = this;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -