var buttons = [
{
"label" : '<span style="font-weight: bold;">B</span>',
"title" : "Bold",
"method" : "setBold"
},
{
"label" : '<span style="text-decoration: underline;">U</span>',
"title" : "Underline",
"method" : "setUnderline"
}
];
for (var i = 0; i < buttons.length; ++i) {
var button = document.createElement("div");
button.className = "button";
button.innerHTML = buttons[i]["label"];
button.title = buttons[i]["title"];
var method = buttons[i]["method"];
button.onclick = function() {
var code = "self." + method + "();";
alert(code);
eval(code);
}
iframeBar.appendChild(button);
}
А так какую бы "кнопку" не нажал выскакивает "self.setUnderline();"