jitk_addresources.js
来自「esri的ArcGIS Server超级学习模板程序(for java)」· JavaScript 代码 · 共 49 行
JS
49 行
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 + =
减小字号Ctrl + -
显示快捷键?