javascript image toggling
- by Sunil Ramu
I have a tree view which has a folder icon by default and once clicked it has to be changed to a checkbox icon. And further on clicking the checkbox icon should display a folder icon.
Sample Code,
Server side : c#
htmlSb.AppendFormat(" {0}", emptyContent);
JS code
var Test= new Object();
Test.Controls=new Object();
Test.Controls.TreeView = new Object();
**Test.Controls.TreeView.SelectNode = function (TreeId, nodeLabel) {
$("#" + TreeId + " li span, ul li span").css("background-color", "transparent");
nodeLabel.style.backgroundColor = "white";
nodeLabel.style.background = "url(../images/selected.gif) 0 0 no-repeat";
}**
The other Image :
if (nodeLabel.style.background = "url(../images/folderclosed.gif) 0 0 no-repeat")
I need to toggle between "selected.gif" and "folderclosed.gif" images. If one is clicked the other should display. and vice versa.
Please help.