:: Documentation >>

HTML

The main function of the most ActiveWidgets classes is generating HTML string based on specified parameters and attached data sources. This is normally done via toString() method.

var obj = new AW.HTML.DIV;
var html = obj.toString();
alert(html);

In the example above calling obj.toString() produces <div id="aw0"></div>. In most cases where the object is used in a 'string context' the javascript interpreter will automatically invoke toString() method. It allows using shorter syntax, like

alert(obj); // same as alert(obj.toString());
document.write(obj); // same as document.write(obj.toString());
e.innerHTML = obj1 + obj2; // same as obj1.toString() + obj2.toString();
s = [obj1, obj2, obj3].join("");

AW also inserts unique id attribute which allows finding and replacing the generated html elements with the new ones when the object parameters or linked data change (using refresh() method).

var obj = new AW.HTML.DIV;
obj.setContent("message", "Click me");
obj.setEvent("onclick", changeText);
document.write(obj);

function changeText(){
    this.setContent("message", "ok");
    this.refresh(); // repaints DIV with new text
}

Comments

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5