EsriUtils
这是一个可以用在任何应用中的功能属性和函数的集合。EsriUtils 是一个为方便使用的预定义全局变量。EsriUtils对象定义了一些跨浏览器的属性和函数,可以用来代替自定义属性和函数。例如:
- 使用EsriUtils.getXY来获得事件的XY坐标
- 使用 EsriUtils.setElementStyle来设置HTML元素的的position和style而不是使用HTMLElement.cssText
boolean doPostBack | Enables/Disables whether the page is submitted to the server for a complete refresh or the page is refreshed through AJAX (postback). Default is true |
String graphicsType | String name of graphics type supported by browser. (if IE, then "VML", else "NS") |
boolean isFF15 | true of browser is Firefox 1.5 |
boolean isIE | true if browser is "microsoft" |
boolean isIE7 | true of browser is "internet explorer 7" |
boolean isNav | true if browser is "netscape" |
Number KEY_DOWN | Down cursor keycode. Default is 40 |
Number KEY_ENTER | Enter key keycode. Default is 13 |
Number KEY_ESCAPE | Escape key keycode. Default is 27 |
Number KEY_LEFT | Left cursor keycode. Default is 37 |
Number KEY_RIGHT | Right cursor keycode. Default is 39 |
Number KEY_UP | Up cursor keycode. Default is 38 |
Number leftButton | Mouse Left button. Default is 1 |
Number mouseWheelUnit | Unit value for each movement of mouse wheel. If IE, then 120, else 3 |
String navType | String name of browser (IE/Firefox/Opera/Safari/Netscape/Mozilla) |
Number rightButton | Right button. If IE, then 2, else 3 |
String userAgent | Browser's user-agent String |
Function Summary
void addFormElement(String formId, String name, String value) | Adds a hidden input field of argument name and value within the form with argument formId |
String buildRequestParams(String formId) | Build request parameter string based on valid form elements in form with argument id |
void cloneElementStyle(HTMLElement source, HTMLElement target) | Clones the style properties of the source element and sets to the target element |
EsriGraphicsElement createGraphicsElement(String id, HTMLElement container) | Creates an EsriGraphicsElement object based on the EsriUtils.graphicsType value and adds it to the argument container |
HTMLImage createImage(String src, String width, String ht) | Creates an image object. Depending on whether IE or not, sets the filter to support PNG transparency. The required width and height arguments can be specified as "px", "%", etc. For example "16px", "50%", etc |
XmlHttpObject createXmlHttpObject() | Creates and returns a browser specific XMLHttpRequest object |
Number fromHex(Hex hex) | Converts argument hexadecimal number to its base 10 number |
EsriRectangle getElementBounds(HTMLElement e) | Returns the rectangle bounds of the argument HTMLElement as specified in it's CSSStyleDeclaration |
EsriRectangle getElementPageBounds(HTMLElement e) | Returns the rectangle bounds of the argument HTMLElement as rendered in the current document |
HTMLElement[] getElementsByClassName(HTMLElement element, String className) | Returns all child elements of argument element who's class name matches the argument className |
HTMLElement getEventSource(Event e) | Returns the HTMLElement on which the argument event was performed |
String getJSessionId() | Returns the JSESSIONID COOKIE value from the browser |
Number getKeyCode(Event e) | Returns the key code for the argument event |
Number getMouseButton(MouseEvent e) | Returns which mouse button was clicked in argument event |
EsriRectangle getPageBounds() | Returns the size of the current document window |
String getServerUrl(String formId) | Returns the url to server as defined in the action attribute of the form with argument formId. If jsessionid is not already in action, it is appended by calling EsriUtils.getJSessionId() |
CSSStyleDeclaration getStyleByClassName(String name) | Returns the style class decleration from the page. If style decleration is not found, null is returned. (example : name "#body" returns ["background-color"], name "image.esriMapImage" returns ["position", "border", "margin", "padding"]) |
Number getStyleValue(String str) | Returns the value (as Number) of a style property |
EsriPoint getXY(MouseEvent e) | Returns the point where the argument mouse event was fired |
void hideElement(HTMLElement element) | Hide argument element. (set style attribute "display:none") |
boolean isLeftButton(MouseEvent e) | Returns true if left mouse button is clicked in argument event |
void moveElement(HTMLElement element, Number left, Number top) | Move element to argument left and top position |
void removeElementStyle(HTMLElement element, CSSStyleDeclaration styleString) | Removes style properties from element based on list from argument style string. (example: "left:; top:;", removes the left & top style properties from the argument element) |
void removeFormElement(String formId, String name) | Removed the form element of argument name from form with argument formId |
XmlHttpObject sendAjaxRequest(String url, String params, boolean doGET, function callback[, String contentType]) | Send an Asynchronous Javascript & XML request to server at argument url, with argument parameters. If doGet is true, send as GET request else POST request. When processing request, callback argument function. [See AJAX documentation] |
void setElementOpacity(HTMLElement element, Number opacity) | Set the argument element's opacity. The opacity must be in the range of 0 to 1 |
void setElementStyle(HTMLElement element, CSSStyleDeclaration styleString) | Set the argument element's CSSStyleProperties. The argument styleString is in the standard css style string. This is the prefered way for setting an element's style |
void setImageSrc(HTMLElement element, String src) | If browser is IE6, then creates a filter and sets AlphaLoader to argument src, else sets the element's source property to the argument src |
void showElement(HTMLElement element) | Show argument element (set style attribute "display:block") |
void stopEvent(Event e) | Stops the propagation of the argument event |
void submitForm(String formId[, boolean async, function callback]) | Submits the form with argument formId. If optional flag async is true, the form is submitted using XmlHttp and argument callbackFunction called when request processing is complete. [See AJAX documentation] |
void toggleElement(HTMLElement element) | Toggle visibility of argument element |
Hex toHex(Number num) | Converts argument number to its hexadecimal representation |
EsriControls
EsriControls是一个用来访问所有maps,overviews,tasks,tocs和toolbars的全局对象
Function Summary
Callback/Listener Function Summary
|