One of my colleague was using a treeview. He was not able to get the value of the node selected in a checkbox,the nodes were rendering in a td,say the name of the node is Apple and name of the treeview is tview :-
<td><div style="width:20px;height:1px"></div></td><td><a id="tviewn1" href="javascript:TreeView_ToggleNode(tview_Data,1,tviewn1,' ',tviewn1Nodes)"><img src="/WebResource.axd?d=PdMRdQjqg37GIsWXhYj7raI9LeI5Q965f8gqjMBRo-o1&t=633651122037812682" alt="Expand Apple" style="border-width:0;" /></a></td><td style="white-space:nowrap;"><input type="checkbox" name="tviewn1CheckBox" id="tviewn1CheckBox" /><span class="tview_0" id="tviewt1">Apple</span></td>
The javascript to get the node name in this case will be :-
function getSelectedNodeValue() { var storeTemp = '' var x=document.getElementsByTagName("td"); for(var i=0;i { var srch=x[i].innerHTML; if(srch.search('CHECKED')>=0) { // alert(x[i].innerText); storeTemp += x[i].innerText + ','; } } storeTemp = storeTemp.substring(0,storeTemp.lastIndexOf(',')); alert(storeTemp); }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|