DHTMLX Docs & Samples Explorer

Attaching URLs to Accordion

Source
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxaccordion.js"></script>
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxaccordion_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcontainer.js"></script>
 
<div id="accordObj" style="position: relative; width: 320px; height: 400px;"></div>
<div style="margin: 50px 0px 20px 0px;">
<input type="button" value="www.google.com" onclick="attachURL('a1', 'http://www.google.com', this.value);">
<input type="button" value="www.yahoo.com" onclick="attachURL('a2', 'http://www.yahoo.com', this.value);">
</div>
<script>
var dhxAccord;
function init() {
    dhxAccord = new dhtmlXAccordion("accordObj");
    dhxAccord.addItem("a1", "a");
    dhxAccord.addItem("a2", "b");
    dhxAccord.addItem("a3", "c");
    dhxAccord.openItem("a1");
}
function attachURL(id, url, text) {
    dhxAccord.cells(id).attachURL(url);
    dhxAccord.cells(id).setText(text);
}
</script>