The global $ variable is an alias for getEBCS.
a = $(selector[, node]);
divs = $('div div div');
divs = $('div.myclass');
divs = $('#myid div');
divs = $('div + div#myid');
divs = $('div ~ div#myid');
links = $('a[href]');
homelinks = $('a[rel~=home]');
stylesheets = $('a[rel~=stylesheet]');
alternatestylesheets = $('link[rel~=stylesheet][rel~=alternate]');
The function returns an array of elements.
The global API variable is an object that encapsulates all library functions.
The absoluteElement function positions an element absolutely, preserving its position and size.
absoluteElement(el);
API.absoluteElement(el);
The addBookmark function calls on the browser to display its bookmarking (AKA favorites) dialog with the supplied location and title.
addBookmark(href, title[, win]);
API.addBookmark('http://www.hartkelaw.net', 'Hartke Law Firm');
The addBookmarkCurrent function calls on the browser to display its bookmarking (AKA favorites) dialog with the current location and title.
addBookmarkCurrent([win]);
API.addBookmarkCurrent();
The addClass function adds a CSS class to an element.
addClass(el, className);
API.addClass(el, 'sidebar');
The addElementHtml function adds HTML to an element, preserving listeners attached to the existing nodes.
addElementHtml(el, html);
API.addElementHtml(el, '<p>And the first guy says...</p>');
The addElementScript function adds script to a script element.
addElementScript(el, script);
API.addElementScript(el, 'window.alert("Hello world!")');
The addElementNodes function adds nodes to an element.
addElementNodes(el, elNewNodes);
API.setElementHtml(elNew, '<p>Why would I exchange it?</p><p>It's the perfect colour!</p>'); API.addElementNodes(elDiv, elNew);
The addElementText function adds text to an element.
addElementText(el, text);
API.addElementText(el, 'Burma-Shave');
The addOption function adds an option to a select element.
addOption(el, text[, value]);
API.addOption(el, 'Apples'); API.addOption(el, 'Apples', 'apples'); elOption = API.addOption(el, 'oranges');
The function returns the new option.
The addOptions function adds one or more options to a select element.
opt = addOption(el, options);
API.addOptions(el, { apples:'Apples', oranges:'Oranges' });
The addScript function adds script to a document.
addScript(text[, docNode]);
API.addScript('window.alert("Hello World!")');
API.addScript('window.alert("Hello Yourself!")', doc);
The addStyleRule function adds a CSS rule to a document. It is typically used to hide content during the page load, after which the content is enhanced and/or made visible, depending on the available features of the environment.
Note that the canAdjustStyle function should be consulted before hiding content in this way.
addStyleRule(selector, rule[, media[, docNode]]);
API.addStyleRule('.banner { display:none }', 'handheld');
API.addStyleRule('.flash { visibility:hidden }');
API.addStyleRule('.flash { visibility:hidden }', 'all', doc);
The adjacentElement function positions an element adjacent to another.
adjacentElement(el, elAdjacent[, side]);
API.adjacentElement(elMenu, elParentMenu, 'right');
The applyDirectXTransitionFilter function applies a DirectX transition.
applyDirectXTransitionFilter(el, name[,duration[, params]]);
API.applyDirectXTransitionFilter(el, 'fade', 1000);
API.applyDirectXTransitionFilter(el, 'iris', { irisstyle:'STAR' });
The areFeatures function is used to test features of the API. This allows application to degrade gracefully in older, buggy or otherwise limited environments.
b = areFeatures(feature1[, feature2, ... feature n]);
canRunApp = API.areFeatures('getEBI', 'getOpacity', 'setScrollPosition');
The attachContextClickListener function adds a listener to an element for two events (contextmenu and mouseup), calling the specified function once per click of the context button.
attachContextClickListener(el, fn[, context]);
API.attachContextClickListener(el, function() { window.alert('Do not do this!'); });
API.attachContextClickListener(el, function() { this.log('context'); }, clickHistory);
The attachDocumentListener function adds an event listener to a document.
attachDocumentListener(ev, fn[, context[, docNode]]);
API.attachDocumentListener('click', function() { window.alert('Hello again!'); });
API.attachDocumentListener('click', function() { this.doSomething(); }, someObject);
API.attachDocumentListener('click', function() { this.doSomethingElse(); }, someObject, doc);
The attachDocumentReadyListener function adds a DOMContentLoaded listener to a document and a load listener to the document's window, calling the specified function once when the document is ready for programmatic manipulation. The load event is used as a fallback for browsers that do not support the DOMContentLoaded event (e.g. Internet Explorer, Safari.) As the load event is not fired until all document assets (e.g. images, Flash movies) are fully loaded, it is usually preferable to call the documentReady function from a script at the end of the body element. The Document Ready add-on serves this purpose.
Note that some features of the library are not available until the document is ready (e.g. DirectX.) Code that utilizes these features should be wrapped in a function that is passed to attachDocumentReadyListener.
attachDocumentReadyListener(fn[, docNode]);
API.attachDocumentReadyListener(function() { window.alert('Ready!'); });
API.attachDocumentReadyListener(function() { window.alert('Me too!'); }, doc);
if (!API.attachDocumentReadyListener(function() { window.alert('Me too!'); }, doc)) {
window.alert('No idea when that document will be ready');
}
The function returns a boolean indicating whether the operation was successful.
The attachHelpListener function adds a listener to an element for two events (help and keydown), calling the specified function once per press of the help key.
attachHelpListener(el, fn[, context]);
API.attachHelpListener(el, function() { window.alert('Help!'); });
API.attachHelpListener(el, function() { this.showHelp(); }, helpObject);
The attachListener function adds an event listener to an element.
attachListener(el, ev, fn[, context]);
API.attachListener(el, 'click', function() { window.alert('Clicked!'); });
API.attachListener(el, 'click', function(e) { this.onclick(e); }, someObject);
The attachMousewheelListener function adds a listener for two events (mousewheel and dommousescroll), calling the specified function once per mousewheel movement. In addition to passing the standard event parameter, a second argument indicates the direction and distance of the movement.
attachMousewheelListener(el, fn[, context]);
API.attachMousewheelListener(el, function(e, delta) { window.status = delta; });
API.attachMousewheelListener(el, function(e, delta) { this.onmousewheel(e, delta); }, someObject);
The attachRolloverListeners function adds listeners to an element for two events (mouseover and mouseout), calling each of the two passed functions as appropriate. Optionally, it adds the listeners for the focus and blur events. Another option allows for the automatic display of the element's title in the status bar (requires Status Bar module.)
attachRolloverListeners(el, fnOver, fnOut[, context[, bAddFocusListeners[, bSetStatus]]]);
API.attachRolloverListeners(el, function() { window.status = 'over'; }, function() { window.status = 'and out'; } );
API.attachRolloverListeners(el, function(e) { this.onover(e); }, function(e) { this.onout(e); }, someObject);
The attachWindowListener function adds an event listener to a window.
attachWindowListener(ev, fn[, context[, win]]);
API.attachWindowListener('resize', function() { window.status = 'Resized'; });
API.attachWindowListener('scroll', function(e) { this.onscroll(e); }, someObject);
The canAdjustStyle function tests if the specified style (display, position or visibility) can be changed programmatically.
b = canAdjustStyle(style);
if (API.canAdjustStyle('visibility') && API.canAdjustStyle('display')) {
enhanceDocument();
}
The function returns a boolean.
The cancelDefault function prevents the default action of an event.
cancelDefault(e);
API.cancelDefault(e); return API.cancelDefault(e); // Compatible with DOM0
The cancelPropagation function prevents the bubbling of an event.
cancelPropagation(e);
API.cancelPropagation(e);
The centerElement function centers an element in the viewport.
centerElement(el);
API.centerElement(el);
centerElement(el[, options[, callback]]);
API.centerElement(el);
API.centerElement(el, { duration:1000, ease:API.ease.circle });
API.centerElement(el, { duration:1000, ease:API.ease.circle }, fn);
Note that like showElement, sizeElement, positionElement, maximizeElement, restoreElement, changeImage, setElementHtml and setElementNodes this function has an async property, which determines whether a callback is supported. This is used by the test page as it has to deal with any build, but is not needed for normal applications as the signature is known at build time, in this case depending on whether FX is included.
The changeImage function changes the source of an image. The source may be specified by an image location or the handle of a preloaded image. The optional parameters are for use with effects modules (e.g. DirectX), which replace the standard function with one that supports progressively rendered changeovers.
changeImage(el, src[, options[, callback]]);
API.changeImage(el, 'http://www.cinsoft.net/images/cinsoft.gif');
API.changeImage(el, 'http://www.cinsoft.net/images/cinsoft.gif', { effects: API.effects.fade, duration:1000, ease:API.ease.circle });
API.changeImage(el, 'http://www.cinsoft.net/images/cinsoft.gif', { effects: [API.effects.fade, API.effects.grow], duration:1000, ease:API.ease.circle });
Note that like showElement, sizeElement, positionElement, maximizeElement, restoreElement, centerElement, setElementHtml and setElementNodes this function has an async property, which determines whether a callback is supported. In this case, as with setElementHtml and setElementNodes, the signature is not known at build time, which is unfortunately awkward and will be changed in the future.
The clonePreloadedImage function creates an image element from a preloaded image.
el = clonePreloadedImage(handle);
handle = API.preloadImage('http://www.cinsoft.net/images/cinsoft.gif', 100, 100);
img = API.clonePreloadedImage(handle);
The function returns an image element.
The cookiesEnabled function tests if cookies are enabled.
b = cookiesEnabled();
var b = API.cookiesEnabled();
The function returns a boolean.
The createElement function creates an (X)HTML element.
el = createElement(tag[, docNode]);
var el = API.createElement('div');
var el = API.createElement('div', doc);
The function returns an element.
The createElementWithAttributes function creates an (X)HTML element and sets one or more attributes.
el = createElementWithAttributes(tag, attributes[, docNode]);
el = API.createElementWithAttributes('div', { id:'me', 'class':'hello' });
el = API.createElementWithAttributes('div', { id:'you', 'class':'hello' }, doc);
The function returns an element.
The createElementWithProperties function creates an (X)HTML element and sets one or more properties.
el = createElementWithProperties(tag, properties[, docNode]);
el = API.createElementWithProperties('input', { type:'checkbox', checked:true });
The function returns an element.
The createFlash function creates a Flash movie, replacing the element with the specified id (if the required version of Flash is available). The Flash movie is not created until the document is ready. The fallback content is hidden during load (when possible).
createFlash(uri, id[, options]);
var vars = new API.FlashVariables();
vars.addQuery('name1');
vars.addBookmark('name3');
vars.add('name1', 'Test 1');
vars.add('name2', 'Test 2');
vars.add('name3', 'Test 3');
API.createFlash('http://www.cinsoft.net/flash/testflash_vars.swf', 'flashFallback2', { height:120, width:300, variables:vars, versionRequired:6 });
The createXmlHttpRequest creates an XHR object.
xhr = createXmlHttpRequest();
xhr = API.createXmlHttpRequest();
The function returns an XHR object.
The deleteCookie function deletes a cookie.
deleteCookie(name[, path[, docNode]]);
API.deleteCookie('test');
The deleteCookieCrumb function deletes a portion of a cookie.
deleteCookieCrumb(name, crumb[, docNode]);
API.deleteCookieCrumb('test', 'testing');
The detachListener function removes an event listener from an element.
detachListener(el, ev, fn);
API.detachListener(el, 'click', fn);
The detachDocumentListener function removes an event listener from a document.
detachDocumentListener(ev, fn[, docNode]);
API.detachDocumentListener('click', fn);
API.detachDocumentListener('click', fn, doc);
The detachWindowListener function removes an event listener from a window.
detachWindowListener(ev, fn[, win]);
API.detachWindowListener('resize', fn);
API.detachWindowListener('scroll', fn, doc);
The dispatchEvent function fires an event for an element, resulting in the execution of listeners attached to the specified event.
dispatchEvent(el, ev[, evType]);
API.dispatchEvent('click', el);
The documentReady function tests if the document is ready.
b = documentReady();
b = API.documentReady();
The function returns a boolean.
The documentReadyListener function is called internally when the document is ready. It is exposed as a method so it can be called by script at the end of the body element, such as the Document Ready add-on.
documentReadyListener();
API.documentReadyListener();
The ease object contains easing functions.
p = ease(p);
API.ease.linear = function(p) {
return p;
};
...where p is a number from 0 to 1.
The effects object contains effect functions.
effect(el, p, scratch[, endCode]);
API.effects.something = function(el, p, scratch, endCode) {
switch (endCode) {
case 1:
...
case 2:
...
default:
...
}
};
The endCode argument indicates the initialization (1) or completion (2) of the effect. The scratch object is typically used to store and restore inline styles on initialization and completion respectively. The default operation typically involves mutating styles of the element per the percentage p.
The elementContainedInElement determines whether an element is completely contained in another (according to the layout, not the DOM structure).
b = elementContainedInElement(el, elContainer);
b = API.elementContainedInElement(el, elContainer);
The function returns a boolean.
The elementOverlapsElement determines whether two elements overlap.
b = elementOverlapsElement(el, el2);
b = API.elementOverlaysElement(el, el2);
The function returns a boolean.
The every function calls the specified function for each element of the specified array, returning true if every result is true.
b = every(a, fn[, context]);
b = API.every(a, function(el, i) { return true; });
b = API.every(a, function(el, i) { return this[i] == el; }, someObject);
The function returns a boolean.
The filter function calls the specified function for each element of the specified array, returning a new array of only the elements for which the result was true.
a = filter(a, fn[, context]);
a = API.filter(a, function(el, i) { return true; });
a = API.filter(a, function(el, i) { return this[i] == el; }, someObject);
The function returns a new array.
The FlashVariables method constructs an object representing variables for a Flash movie.
vars = new FlashVariables();
var vars = new API.FlashVariables();
vars.addQuery('name1');
vars.addBookmark('name3');
vars.add('name1', 'Test 1');
vars.add('name2', 'Test 2');
vars.add('name3', 'Test 3');
The forEach function calls the specified function for each element of the specified array.
forEach(a, fn[, context]);
API.forEach(a, function(el, i) { el.id = 'test' + i });
API.forEach(a, function(el, i) { el.id = this.id(i) }, someObject);
The forEachProperty function calls the specified function for each enumerable property of the specified object.
Note that properties inherited from the object's prototype are excluded.
forEachProperty(o, fn[, context]);
API.forEachProperty(o, function(el, i) { el.id = 'test' + i });
API.forEachProperty(o, function(el, i) { el.id = this.id(i) }, someObject);
The fullScreenElement function displays an element using all of the available space in the viewport, hiding the scrollbars to accomodate.
fullScreenElement(el);
API.fullScreenElement(el);
The getAnchor function finds an anchor element by name or index.
el = getAnchor(i[, docNode]);
elAnchor = API.getAnchor(0);
elAnchor = API.getAnchor('myanchor');
The function returns an anchor element or null if none is found to match the specified name or index.
The getAnchors function finds all anchor elements in a document.
a = getAnchors([docNode]);
anchors = API.getAnchors(); anchors = API.getAnchors(doc);
The function returns an array or array-like object.
Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.
The getAnElement function returns the first element in a document (typically the html element.)
el = getAnElement([docNode]);
el = API.getAnElement('myid');
el = API.getAnElement('yourid', doc);
The function returns an element or null if none is found.
The getAttribute function returns the value of the specified attribute of the specified element.
v = getAttribute(el, name);
c = API.getAttribute(el, 'class'); s = API.getAttribute(el, 'style');
The function returns a string or null if the specified attribute does not exist.
The getAttributeProperty function returns the property value of the specified attribute of the specified element.
v = getAttributeProperty(el, name);
c = API.getAttributeProperty(el, 'class'); b = API.getAttributeProperty(el, 'readonly');
The function returns a string or null if the specified attribute does not exist.
The getBodyElement function returns the body element of a document.
el = getBodyElement([docNode]);
elBody = API.getBodyElement(); elBody = API.getBodyElement(doc);
The function returns a body element or null if none is found.
The getCascadedStyle function returns the named cascaded style of an element.
Note this function is rarely used externally. Use getStyle or getComputedStyle instead.
s = getCascadedStyle(el, style);
s = API.getCascadedStyle(el, 'color'); s = API.getCascadedStyle(el, 'backgroundColor');
Note that as with all style-related functions, the name of the style must be in camel-case.
The function returns a string or null.
The getChildren function returns all child elements of an element or document.
a = getChildren(node);
c = API.getChildren(el);
The function returns an array.
The getComputedStyle function returns the named computed style of an element.
s = getComputedStyle(el, style);
s = API.getComputedStyle(el, 'color'); s = API.getComputedStyle(el, 'backgroundColor');
Note that as with all style-related functions, the name of the style must be in camel-case.
The function returns a string or null.
The getCookie function returns the cookie with the specified name.
c = getCookie(name[, defaultValue[, encoded[, docNode]]]);
c = API.getCookie('test');
c = API.getCookie('test', '');
The function returns a string or null if a cookie with the specified name does not exist.
The getCookieCrumb function returns a portion of a cookie.
s = getCookieCrumb(name, crumb[, defaultValue[, docNode]]);
c = API.getCookieCrumb('test', 'me');
c = API.getCookieCrumb('test', 'me', '');
The function returns a string or null if a cookie with the specified name does not exist.
The getDocumentWindow function returns the containing window of a document.
win = getDocumentWindow([docNode]);
win = API.getDocumentWindow(); win = API.getDocumentWindow(doc);
The function returns a window.
The getEBI function returns an element with the specified ID.
el = getEBI(id[, docNode]);
el = API.getEBI('myid');
el = API.getEBI('yourid', doc);
The function returns an element with the specified ID or null if not found.
The getElementBorder function returns the width of the named border of an element.
w = getElementBorder(id, side);
t = API.getElementBorder(el, 'top'); r = API.getElementBorder(el, 'right');
The function returns a number of pixels.
The getElementBorders function returns an object containing all border widths of an element.
o = getElementBorders(el);
o = API.getElementBorders(el);
window.alert('Top border is: ' + o.top + ' pixels');
The function returns an object with properties named for each side (top, left, bottom and right), containing a number of pixels.
The getElementBordersOrigin function returns an object containing the top and left border widths of an element.
o = getElementBordersOrigin(el);
o = API.getElementBordersOrigin(el);
window.alert('Left border is: ' + o.left + ' pixels');
The function returns an object with properties named for each side (top and left), containing a number of pixels.
The getEBCN function returns elements with the specified class name(s) from an element or document.
el = getEBCN(className[, node]);
els = API.getEBCN(el, 'myclass'); els = API.getEBCN(el, 'myclass yourclass'); els = API.getEBCN(el, 'otherclass', el); els = API.getEBCN(el, 'otherotherclass', doc);
The function returns an array.
The getEBCS function returns elements that match the specified CSS selector from an element or document.
el = getEBCS(selector[, node]);
els = API.getEBCS('div');
els = API.getEBCS('div div div');
els = API.getEBCS('.myclass');
els = API.getEBCS('#myid');
els = API.getEBCS('#myid p.myclass');
els = API.getEBCS('div:first-child');
els = API.getEBCS('div:only-child');
els = API.getEBCS('div:nth-child(5)');
els = API.getEBCS('h2 + div');
els = API.getEBCS('h2 + div#myid');
els = API.getEBCS('h2 ~ div#myid');
The function returns an array.
The getEBTN function returns elements with the specified tag name from an element or document.
el = getEBTN(tag[, node]);
els = API.getEBTN('div');
els = API.getEBTN('div', el);
els = API.getEBTN('div', doc);
The function returns an array or array-like host object.
Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.
The getEBXP function returns elements that match the specified XPath expression from an element or document.
el = getEBXP(path[, node]);
els = API.getEBXP('.//h2/following-sibling::*');
els = API.getEBXP('.//h2/following-sibling::*', el);
els = API.getEBXP('.//h2/following-sibling::*', doc);
The function returns an array.
The getElementDocument function returns the containing document of an element.
el = getElementDocument(el);
doc = API.getElementDocument(el);
The function returns a document or null if the element is part of a fragment.
The getElementMargin function returns the width of the named margin of an element.
w = getElementMargin(id, side);
m = API.getElementMargin(el, 'top');
The function returns a number of pixels.
The getElementMargins function returns an object containing all margin widths of an element.
o = getElementMargins(el);
o = API.getElementMargins(el);
The function returns an object with properties named for each side (top, left, bottom and right), containing a number of pixels.
The getElementMarginsOrigin function returns an object containing the top and left margin widths of an element.
o = getElementMargins(el);
o = API.getElementMarginsOrigin(el);
The function returns an object with properties named for each side (top and left), containing a number of pixels.
The getElementParentElement function returns the parent element of an element.
el = getElementParentElement(el);
el = API.getElementParentElement(el);
The function returns an element or null if the element is has no parent element (e.g. is the child of a document.)
The getElementPosition function returns the absolute position of an element or the position relative to the specified ancestor.
pos = getElementPosition(el[, elContainer]);
p = API.getElementPosition(el); p = API.getElementPosition(el, elContainer);
The function returns an array containing the top and left coordinates.
The getElementText function returns the text of an element.
s = getElementText(el);
s = API.getElementText(el);
The function returns a string.
The getEnabledPlugin function returns the description of an enabled plugin that matches the specified MIME type or title.
p = getEnabledPlugin(mimeType[, title]);
p = API.getEnabledPlugin('audio/x-wav');
The function returns a string or null if an enabled plugin is not found.
The getEventTarget function returns the target element of an event.
el = getEventTarget(e);
el = API.getEventTarget(e);
The function returns an element.
The getEventTarget function returns the related target element of an event. For example, on a mouseover event, the related target is the element the pointer is coming from
el = getEventTargetRelated(e);
el = API.getEventTargetRelated(e);
The function returns an element or null if there is no related target.
The getForm function finds a form element by name or index.
el = getForm(i[, docNode]);
el = API.getForm(0);
el = API.getForm('myform');
el = API.getForm('yourform', doc);
The function returns a form element or null if none is found to match the specified name or index.
The getForms function finds all form elements in a document.
a = getForms([docNode]);
els = API.getForms(); els = API.getForms(doc);
The function returns an array or array-like object.
Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.
The getFlashVersion function returns the installed Flash version if available.
ver = getFlashVersion();
ver = API.getFlashVersion();
The function returns an object containing the major (version), minor (versionMinor) and revision (versionRevision) versions as numbers and the full (versionFull) version as a string.
The getHeadElement function returns the head element of a document.
el = getHeadElement([docNode]);
el = API.getHeadElement(); el = API.getHeadElement(doc);
The function returns a head element or null if none is found.
The getHtmlElement function returns the html element of a document.
el = getHtmlElement([docNode]);
el = API.getHtmlElement(); el = API.getHtmlElement(doc);
The function returns an html element or null if none is found.
The getImage function finds an image element by name or index.
el = getImage(i[, docNode]);
el = API.getImage(0);
el = API.getImage('testimage');
el = API.getImage(0, doc);
The function returns an image element or null if none is found to match the specified name or index.
The getImages function finds all image elements in a document.
a = getImages([docNode]);
els = API.getImages(); els = API.getImages(doc);
The function returns an array or array-like object.
Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.
The getKeyboardKey function returns the code of the keyboard key (or character for keypress events) related to an event.
n = getKeyboardKey(e);
k = API.getKeyboardKey(e);
The function returns a number.
The getLink function finds a link by name or index.
el = getLink(i[, docNode]);
el = API.getLink(0);
el = API.getLink('testlink');
el = API.getLink(0, doc);
The function returns an anchor element or null if none is found to match the specified name or index.
The getLinks function finds all links in a document.
a = getLinks([docNode]);
els = API.getLinks(); els = API.getLinks(doc);
The function returns an array or array-like object.
Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.
The getMouseButtons function returns the state of the mouse buttons during an event.
o = getMouseButtons(e);
o = API.getMouseButtons(e);
The function returns a object with boolean left, middle and right properties.
The getMousePosition function returns the position of the mouse, relative to the document, during an event.
Note that this method may rewrite itself at any time, so always get a fresh reference before calling (or call as a method of API).
a = getMousePosition(e);
a = API.getMousePosition(e);
The function returns an array containing the top and left coordinates (in pixels.)
The getMousewheelDelta function returns the distance and direction traveled by the mousewheel during an event.
n = getMousewheelDelta(e);
n = API.getMousewheelDelta(e);
The function returns a number.
The getOpacity function returns the opacity of an element.
o = getOpacity(el);
o = API.getOpacity(el);
The function returns a number from 0 to 1.
The getOptionValue function returns the value of the specified option element.
s = getOptionValue(el);
s = API.getOptionValue(el);
The function returns a string.
The getQuery function returns the value of the named search parameter.
q = getQuery(name[, defaultValue]);
q = API.getQuery('testing');
q = API.getQuery('testing', '123');
The function returns a string or null.
The getScrollPosition function returns the scroll position of a document.
a = getScrollPosition([docNode]);
a = API.getScrollPosition(); a = API.getScrollPosition(doc);
The function returns an array containing the top and left scroll positions or null if the position cannot be determined.
Note that this method may rewrite itself at any time, so always get a fresh reference before calling (or call as a method of API).
The getStyle function returns the named style of an element or null if unavailable. The function will attempt to use the getComputedStyle or getCascadedStyle functions and then the inline style if necessary.
s = getStyle(el, style);
s = API.getStyle(el, 'color'); s = API.getStyle(el, 'backgroundColor');
The function returns a string or null.
Note that as with all style-related functions, the name of the style must be in camel-case.
The getViewportClientRectangle function returns the size and scroll position of the viewport.
r = getViewportClientRectangle([docNode]);
r = API.getViewportClientRectangle(doc);
The function returns an array containing the top, left, height and width of the viewport.
The getViewportScrollRectangle function returns the top, left, height and width of the top-level rendered element (HTML or body) in a document.
r = getViewportScrollRectangle([docNode]);
r = API.getViewportScrollRectangle(doc);
The function returns an array containing the top, left, height and width of the top-level rendered element (HTML or body) in a document.
The getViewportScrollSize function returns the size of the top-level rendered element (HTML or body) in a document.
s = getViewportScrollSize([docNode]);
r = API.getViewportScrollSize(doc);
The function returns an array containing the height and width of the top-level rendered element (HTML or body) in a document.
The getViewportSize function returns the size of a viewport for the specified document.
s = getViewportSize([window]);
s = API.getViewportSize(doc);
The function returns an array containing the height and width of the viewport.
The hasAttribute function tests if the specified element has an attribute with the specified name.
b = hasAttribute(el, name);
b = API.hasAttribute(el, 'id'); b = API.hasAttribute(el, 'for'); b = API.hasAttribute(el, 'rel');
The function returns a boolean.
The hasClass function tests if the specified element has the specified CSS class.
b = hasClass(el, className);
b = API.hasClass(el, 'myclass');
The function returns a boolean.
The importNode function imports an element from one document into another.
el = importNode(el[, bImportChildren[, docNode]]);
el = API.importNode(elExport); el = API.importNode(elExportWithChildren, true);
The function returns the imported element.
The isHostMethod function tests if the specified host object property references an object.
If the referenced object will not be called, use isHostObjectProperty.
Allowed properties may be of type function, object (IE and possibly others) or unknown (IE ActiveX methods). Object types exclude null.
This test does not assert that an arbitrary property is callable. Pass only names of properties universally implemented as methods.
This test does not support properties that are methods in some browsers but not others (e.g. childNodes). This test will not discriminate between such implementations and applications should never call such objects.
b = isHostMethod(o, p);
b = API.isHostMethod(el, 'getElementsByTagName');
The function returns a boolean.
The isHostObjectProperty function tests if the specified host object property references an object that is safe to evaluate. ActiveX methods and other properties of type unknown are excluded.
If the referenced object will be called, use isHostMethod.
Allowed properties may be of type function, object (IE and possibly others). Object types exclude null.
b = isHostObjectProperty(o, p);
b = API.isHostObjectProperty(el, 'parentNode');
The function returns a boolean.
The isOwnProperty function tests if the specified object does not inherit the specified property from its prototype. The property is stipulated to exist. This function is typically used to filter inherited properties within for-in loops.
Note the object must be native, not a host object.
b = isOwnProperty(o, p);
b = API.isOwnProperty(o, 'apples'); b = API.isOwnProperty(o, 'oranges');
The function returns a boolean.
The isPositionable function determines if an element is positionable (position style is not static).
b = isPositionable(el);
b = API.isPositionable(el);
The function returns a boolean.
The isPresent function determines if an element is part of the layout (display style is not none).
b = isPresent(el);
b = API.isPresent(el);
The function returns a boolean.
The isRealObjectProperty function tests if the specified object property references an object.
Note this function is not for use with host objects.
b = isRealObjectProperty(o, p);
b = API.isRealObjectProperty(obj, 'tree');
The function returns a boolean.
The isVisible function determines if an element is visible (according to its style) and part of the layout (display style is not none).
b = isVisible(el);
b = API.isVisible(el);
The function returns a boolean.
The isXmlParseMode function tests if a document was parsed as XML.
b = isXmlParseMode([docNode]);
b = API.isXmlParseMode(); b = API.isXmlParseMode(doc);
The function returns a boolean.
The map function calls the specified function for each element of the specified array, returning a new array of the results.
a = map(a, fn[, context]);
a = map(a, function(el) { return el.id; });
a = map(a, function(el) { return this.fetchId(el); }, someObject);
The function returns a new array.
The maximizeElement sizes and positions an element to fill its viewport.
maximizeElement(el);
API.maximizeElement(el);
The overlayElement function positions an element to overlay another, optionally covering it.
overlayElement(el, elOver[, cover]);
API.overlayElement(el, elTarget); API.overlayElement(el, elTarget, true);
The playAudio function plays one or more audio files.
playAudio(files, time[, cb[, ext[, volume]]]);
API.playAudio('ding.wav', 1000);
The playDirectXTransitionFilter function plays a DirectX transition.
playDirectXTransitionFilter(el, name);
API.playDirectXTransitionFilter(el, 'fade');
The positionElement function positions an element.
positionElement(el, top, left[, options[, callback]]);
API.positionElement(el, 0, 0);
API.positionElement(el, 0, 0, { duration:1000, ease:API.ease.circle });
The preloadImage function loads and stores the specified image resource.
handle = preloadImage(src, h, w);
handle = API.preloadImage('cinsoft.gif', 100, 100);
The function returns a numeric handle to reference the stored image.
The presentElement function adds or removes an element from the layout (e.g. sets its display property).
presentElement(el[, b]);
API.presentElement(el); API.presentElement(el, false);
The removeClass function removes a CSS class from an element.
removeClass(el, className);
API.removeClass(el, 'testclass');
The removeOptions function removes all options from a select element.
removeOptions(el);
API.removeOptions(el);
The Requester function is a constructor that creates an object that simplifies the process of sending Ajax requests.
requester = new Requester([sId[, sGroup]]);
r = API.Requester('id');
r = API.Requester('id', 'groupid');
The restoreElement function restores the size and position of a previously maximized or full-screen element.
restoreElement(el);
API.restoreElement(el);
The serializeFormUrlencoded function encodes name/value pairs of a form element according to the specification of the application/x-www-form-urlencoded MIME type.
s = serializeFormUrlencoded(form);
s = API.serializeFormUrlencoded(el);
The function returns a string.
The setActiveStyleSheet function activates style sheets with the specified ID for a document. Style sheets with ID's other than the one specified are deactivated. This function is typically used to switch between alternate style sheets.
setActiveStyleSheet(id[, docNode]);
API.setActiveStyleSheet('winter');
API.setActiveStyleSheet('summer', doc);
The setAttribute function sets the value of the specified attribute of the specified element.
el = setAttribute(el, name, value);
el = API.setAttribute(el, 'id', 'myid'); el = API.setAttribute(el, 'style', 'color:red');
The function returns an element, which in some cases may be a replacement (e.g. setting the type attribute of an input element in IE.)
The setAttributeProperty function sets the property value of the specified attribute of the specified element.
el = setAttributeProperty(el, name, value);
el = API.setAttributeProperty(el, 'id', 'myid'); el = API.setAttributeProperty(el, 'readonly', true);
The function returns an element, which in some cases may be a replacement (e.g. changing the type attribute of an input element in IE.)
The setAttributeProperties function sets the property values of the specified attributes of the specified element.
el = setAttributeProperties(el, attributes);
el = API.setAttributeProperties(el, { id:'myid', readonly:true });
The function returns an element, which in some cases may be a replacement (e.g. changing the type attribute of an input element in IE.)
The setAttributes function sets the values of the specified attributes of the specified element.
el = setAttributes(el, attributes);
el = API.setAttributes(el, { id:'myid', 'class':'myclass' });
The function returns an element, which in some cases may be a replacement (e.g. changing the type attribute of an input element in IE.)
The setCookie function sets the cookie with the specified name to the specified value.
setCookie(name, value[, expires[, path[, secure[, docNode]]]]);
API.setCookie('myname', 'myvalue');
API.setCookie('myname', 'myvalue', 7); // Expires in 7 days
The setCookieCrumb function sets a portion of a cookie.
setCookieCrumb(name, crumb, value[,path[, docNode]]);
API.setCookieCrumb('myname', 'mycrumbname', 'myvalue');
The setDefaultStatus function sets the default status bar text for a window.
setDefaultStatus(text[, win]);
API.setDefaultStatus('My Library rocks!');
API.setDefaultStatus('Definitely!', win);
The setElementHtml function sets the inner HTML of an element. The optional parameters are for use with effects modules (e.g. DirectX), which replace the standard function with one that supports progressive rendering.
el = setElementHtml(el, html[options[, callback]]);
API.setElementHtml(el, '<p>This is a test.</p>');
The function returns an element, which in some cases may be a replacement (e.g. select elements in IE.)
The setElementNodes function replaces the nodes of an element. The optional parameters are for use with effects modules (e.g. DirectX), which replace the standard function with one that supports progressive rendering.
setElementNodes(el, elNewNodes[options[, callback]]);
el = API.setElementNodes(el, elNewNodes);
The setElementOuterHtml function sets the outer HTML of an element. The optional parameters are for use with effects modules (e.g. DirectX), which replace the standard function with one that supports progressive rendering.
el = setElementOuterHtml(el, html[options[, callback]]);
el = API.setElementOuterHtml(el, '<p>Testing...</p>');
The function returns an element, which is always a replacement.
The setElementScript function sets the text of a script element.
setElementScript(el, text);
API.setElementScript(el, 'window.alert("Hello world!");');
The setElementText function sets the text of an element.
setElementText(el, text);
API.setElementText(el, 'Hello world!');
The setOpacity function sets the opacity of an element, specified as a number from 0 (invisible) to 1 (opaque).
setOpacity(el, opacity);
API.setOpacity(el, 0.5);
The setScrollPosition function sets the scroll position of a document.
setScrollPosition(t, l[, docNode[, isNormalized[, options[, callback]]]]);
API.setScrollPosition(el, 0, 0); API.setScrollPosition(el, 0, 0, doc);
The setStatus function sets the status bar text for a window.
setStatus(text[, win]);
API.setStatus(el, 'Hello world!'); API.setStatus(el, 'Hello back!', win);
The setStyle function sets the style of the specified element.
setStyle(el, style, rule);
API.setStyle(el, 'color', '#CCCCCC'); API.setStyle(el, 'backgroundColor', '#333333');
Note that as with all style-related functions, the name of the style must be in camel-case.
The setStyles function sets multiple styles of the specified element.
setStyles(el, rules);
API.setStyles(el, { color: '#CCCCCC', backgroundColor:'#333333' });
Note that as with all style-related functions, the name of the style must be in camel-case.
The showElement function shows or hides an element as indicated by the show argument.
showElement(el, [show[, options[, callback]]]);
API.showElement(el);
API.showElement(el, false);
API.showElement(el, false, { removeOnHide: true });
API.showElement(el, false, { effects:API.effects.fade, duration:1000 });
The sizeElement function sizes an element.
sizeElement(el, h, w[, options[, callback]]);
API.sizeElement(el, 100, 100);
API.sizeElement(el, 100, 100, { duration:1000, ease:API.ease.circle });
The some function calls the specified function for each element of the specified array, returning true if at least one result is true.
b = some(a, fn[, context]);
b = API.some(a, function(el) { return el.id.indexOf('test') != -1 });
b = API.some(a, fn, someObject);
The function returns a boolean.
The toArray function copies an array or array-like object to a new array.
a = toArray(c);
a = API.toArray(el.childNodes);
The function returns a array.
The toggleElement function shows or hides an element.
toggleElement(el[, options[, callback]]);
API.toggleElement(el);
API.toggleElement(el, { removeOnHide:true, effects:API.effects.fade, duration:1000 });
The urlencode function encodes a string according to the specification of the application/x-www-form-urlencoded MIME type.
s = urlencode(text);
s = API.urlencode(text);
The function returns a string.
The C function constructs an object that abstracts a form control. This constructor inherits from E.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating C objects from form controls in alternate frames does not require the new operator.
c = C([el]); c = new C([el]);
var c = C('myid');
var c = C(F('myform').controls('myinput'));
window.alert('Value is ' + c.getValue());
The D function constructs an object that abstracts a document.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating D objects from documents in alternate frames does not require the new operator.
d = D([doc]); d = new D([doc]);
var d = D();
window.alert(d.isXHTML());
d.onReady(function() { window.alert('Ready'); });
d.on('click', function() { this.setScrollPosition(100, 0); });
var q = d.query('.testclass');
The E function constructs an object that abstracts an element.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating E objects from elements in alternate frames does not require the new operator.
e = E(id); e = new E(id);
var e = E(API.getHtmlElement());
e.onHelp(function() { window.alert('Help') }).onContextClick(function() { window.alert('Context click') });
e.load('testid');
e.fadeIn({ duration:1000 }).on('click', function() { window.alert('Clicked'); });
E().loadHtml('<div><strong>This is a test<\/strong><\/div>').appendTo(document.body);
The F function constructs an object that abstracts a form element. This constructor inherits from E.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating F objects from forms in alternate frames does not require the new operator.
f = F(id); f = new F(id);
var s, f = F(0); s = f.serialize(); f.send();
The I function constructs an object that abstracts an image element. This constructor inherits from E.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating I objects from images in alternate frames does not require the new operator.
i = I(id); i = new I(id);
var i = I(0);
i.loadURI('testuri').slideIn({ duration:1000 }).on('click', function() { window.alert('Image clicked'); });
The Q function constructs an object that abstracts multiple elements.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating Q objects that query documents in alternate frames does not require the new operator.
q = Q(selector); q = new Q(selector);
var q = Q('div:last-child');
q.addClass('testclass').zoomIn({ duration:1000 }).on('click', function() { window.alert('Clicked'); });
q.load('div>div').addClass('testclass2').fadeIn({ duration:1000 }).on('click', function() { E(this).verticalBlindsOut({ duration:1000 }); });
q.load("#two.test1[test=test][test2]:first-child").slideIn({ duration:1000 }).on('click', function() { this.fadeOut({ duration:1000 }); }, q);
The W function constructs an object that abstracts a window.
Note: Always use with the new operator if calling the constructor from an alternate frame. Creating W objects from alternate frames does not require the new operator.
w = W([window]); w = new W([window]);
var w = W();
var s = w.getViewportSize();
w.setStatus('Viewport size ' + s);
w.addBookmark('http://www.cinsoft.net/mylib.html', 'My Library');
Last Modified: 2 Feb 2010 22:29:00 GMT
dmark@cinsoft.net