Attache events to Items
Events Log
Change Items Type
F-iconF-tiles
F-table
<script src="../../codebase/dhtmlxcommon.js" type="text/javascript"></script> <script src="../../codebase/dhtmlxfolders.js" type="text/javascript"></script> <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxfolders.css"> <script></script> <div style="position:relative;"> <img src="../common/images/samples_frame.gif" width="436" height="513" alt="" border="0"> <div id="folders_container" style="width:396px;height:400px;overflow:hidden;position:absolute;top:65px;left:20px;border:0px solid red;"></div> <div id="stat" style="position:absolute;left:450px;top:10px"><h3>Events Log</h3></div> </div> <h3>Change Items Type</h3> <input type="radio" name="switch" onclick="changeType(this.value)" value="ficon" checked> F-icon<br> <input type="radio" name="switch" onclick="changeType(this.value)" value="ftiles"> F-tiles<br> <input type="radio" name="switch" onclick="changeType(this.value)" value="ftable"> F-table<br>var myFolders; function doOnLoad() { myFolders = new dhtmlxFolders("folders_container"); myFolders.setItemType("ficon"); myFolders.setUserData("icons_src_dir", "../common/images"); myFolders.loadXML("../common/files_ext_03_events.xml", "../../codebase/types/ficon.xsl"); //attach doOnClick function as onclick event handler; function doOnDblClick(itemId) { setStatus("dblclick. Item ID is " + itemId); } function doOnClick(itemId) { setStatus("click. Item ID is " + itemId); } myFolders.attachEvent("onclick", doOnClick); myFolders.attachEvent("ondblclick", doOnDblClick); } function changeType(type) { myFolders.setItemType(type, "../../codebase/types/" + type + ".xsl"); } function setStatus(str) { document.getElementById("stat").innerHTML += str + "<br>"; }