API Docs for: TiledImage pre 1.0
Show:

d Class

Module: d.js

Global Object for DOM tools. javascript has DOM functions to change the HTML elements dynamically. However, the commands name is long and not useful. This object provides short names and useful functions.

Item Index

Properties

Methods

addEv

(
  • hash
)
public

Add an event listener to A DOM Element.

Parameters:

  • hash Object

    t: target DOM, m: event messeage without "on", f:function.

app

(
  • par
  • t
  • opt
)
public

append new DOM Element as the last child of par Element .

Parameters:

  • par DOMElement

    Parent DOM Element.

  • t String

    target element DOM Element.

  • opt Object

    attribute and childs. See d.mod .

Returns:

DOMElement created and appended

cat

(
  • a
  • b
)
Array public

concat two array. a array added all of b array at the end of a array.

Parameters:

  • a Array

    Array to modified

  • b Array

    Array which has childs to add

Returns:

Array: Modified a array.

get

(
  • id
)
public

Get a DOM element named id.

Parameters:

  • id String

    Id of the element.

go

(
  • e
  • pos
)
public

Move DOM Element to there. The DOM must has style.position "absolute" or "relative".

Parameters:

  • e DOMElement

    A DOM Element.

  • pos ArrayNumber

    Array of [left,top].

json2html

(
  • e
  • json
)
public

Create DOM Elements under the e element. This is an enhansment of d.app. order of json become the order of child. The children of Array must be 3 type.

  • String: the string become text node. Note that you cannot add HTML tags here.
  • Array: Become an element. [0] becomes tag name (must be String.), [1] becomes child nodes. (it must be Array as the parameter __json__.)
  • Object: 0: as the same with Array's 0. 1: as the same with Array's 1. the others: become the attribute of the element. See d.mod for detail.

Parameters:

  • e DOMElement

    A DOM Element.

  • json Array

    representation of HTML.

mod

(
  • e
  • opt
)
public

append or modify childs of e object by opt object. If e and opt has a child of the same name, it is overwrite by opt's. This is well used for attribute setting of DOM Element and setting method functions in a new object. Thus, this function does not copy recursively. There is one exception. if opt has the child "style" and pass both of the "style" child to d.style method.

Parameters:

  • e DOMElement

    Parent DOM Element.

  • opt Object

    object of modifing childs.

Returns:

DOMElement created and appended

prep

(
  • par
  • t
  • opt
)
public

insert new DOM Element as a first child of par Element.

Parameters:

  • par DOMElement

    Parent DOM Element.

  • t String

    target element DOM Element.

  • opt Object

    attribute and childs. See d.mod .

Returns:

DOMElement created and prepended

Example:

<div id="debug"></div>
<script>
d.prep(d.get("debug"),"p",{innerHTML:"123"});
</script>

removeAll

(
  • e
)
public

remove all the children of the DOM element.

Parameters:

  • e DOMElement

    A DOM Element.

rmEv

(
  • hash
)
public

Remove an event listener to A DOM Element.

Parameters:

  • hash Object

    t: target DOM, m: event messeage without "on", f:function.

style

(
  • e
  • sty
)
public

set style of DOM element.

Parameters:

  • e Object

    style arribute of A DOM Element.

  • sty Object

    object of strings for styling.

Properties

d

DOM Element public

abbreviation of document

Default: document

ie

Integer public

A Flag for Old Internet Explores.

0
mozilla.org gecco engine (fireforx, seamonkey or some)
1
InternetExplore older than Ver. 9
2
InternetExplore after ver. 9 or opera

root

String public

root path of script codes.