1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form method="post" action="" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE1NjQyMDI5MzkPZBYCAgMPZBYEAgEPZBYCZg8QZBAVAQczIEl0ZW1zFQEHMyBJdGVtcxQrAwFnZGQCBQ8PFgIeBFRleHQFDlRydWUsVHJ1ZSxUcnVlZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFggFDGNoa0xzdEl0ZW0kMAUMY2hrTHN0SXRlbSQxBQxjaGtMc3RJdGVtJDIFDGNoa0xzdEl0ZW0kMwUMY2hrTHN0SXRlbSQ0BQxjaGtMc3RJdGVtJDUFDGNoa0xzdEl0ZW0kNgUMY2hrTHN0SXRlbSQ2UAJRW1Bagcj6qR2XxbtrJdYxeVIy0ucHNwS02jWLH+g=" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCwKUuODGAwKs8ab4AgLE1a2eBwLE1cH5DwLE1dXUCALE1emvAQLE1d2xBALE1fGMDQLE1YXoBQKSoqqWDwLN3+SwD8beZKCqd7uErb0I43PIUUOTwvPqDOynHSFKGovSHObT" />
</div>
<div>
<table>
<tr>
<td valign="top" style="width: 165px">
<select name="ddlChkList" id="ddlChkList" onmousedown="showdivonClick()" style="width:155px;">
<option value="3 Items">3 Items</option>
</select><div id="divChkList" style="border:black 1px solid;width:160px;height:180px;overflow:AUTO;display:none;"><table id="chkLstItem" onmouseover="showdiv()">
<tr>
<td><input id="chkLstItem_0" type="checkbox" name="chkLstItem$0" onclick="getSelectedItem('ListItem1','0','1','listItem');" value="1" /><label for="chkLstItem_0"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' ListItem1','0','1','anchor');">ListItem1</a></label></td>
</tr><tr>
<td><input id="chkLstItem_1" type="checkbox" name="chkLstItem$1" checked="checked" onclick="getSelectedItem('ListItem2','1','2','listItem');" value="2" /><label for="chkLstItem_1"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' ListItem2','1','2','anchor');">ListItem2</a></label></td>
</tr><tr>
<td><input id="chkLstItem_2" type="checkbox" name="chkLstItem$2" checked="checked" onclick="getSelectedItem('ListItem3','2','3','listItem');" value="3" /><label for="chkLstItem_2"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' ListItem3','2','3','anchor');">ListItem3</a></label></td>
</tr><tr>
<td><input id="chkLstItem_3" type="checkbox" name="chkLstItem$3" onclick="getSelectedItem('My ListItem Wraps also','3','4','listItem');" value="4" /><label for="chkLstItem_3"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' My ListItem Wraps also','3','4','anchor');">My ListItem Wraps also</a></label></td>
</tr><tr>
<td><input id="chkLstItem_4" type="checkbox" name="chkLstItem$4" checked="checked" onclick="getSelectedItem('My New ListItem5','4','5','listItem');" value="5" /><label for="chkLstItem_4"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' My New ListItem5','4','5','anchor');">My New ListItem5</a></label></td>
</tr><tr>
<td><input id="chkLstItem_5" type="checkbox" name="chkLstItem$5" onclick="getSelectedItem('ListItem6','5','6','listItem');" value="6" /><label for="chkLstItem_5"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' ListItem6','5','6','anchor');">ListItem6</a></label></td>
</tr><tr>
<td><input id="chkLstItem_6" type="checkbox" name="chkLstItem$6" onclick="getSelectedItem('ListItem7','6','7','listItem');" value="7" /><label for="chkLstItem_6"><a href="javascript:void(0)" id="alst" style="text-decoration:none;color:Black; " onclick="getSelectedItem(' ListItem7','6','7','anchor');">ListItem7</a></label></td>
</tr>
</table></div>
</td>
<td valign="top">
<input type="submit" name="btn" value="Get Checked" id="btn" />
</td>
<td valign="top">
<span id="lblSelectedItem">True,True,True</span>
</td>
</tr>
</table>
<input type="hidden" name="hidList" id="hidList" value="3 Items" />
</div>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
function showdiv() {
document.getElementById("divChkList").style.display = "block";
}
function showdivonClick() {
var objDLL = document.getElementById("divChkList");
if (objDLL.style.display == "block")
objDLL.style.display = "none";
else {
objDLL.style.display = "block";
}
}
function getSelectedItem(lstValue, lstNo, lstID, ctrlType) {
var noItemChecked = 0;
var ddlReport = document.getElementById("ddlChkList");
var selectedItems = "";
var arr = document.getElementById("chkLstItem").getElementsByTagName('input');
var arrlbl = document.getElementById("chkLstItem").getElementsByTagName('label');
var objLstId = document.getElementById('hidList');
for (i = 0; i < arr.length; i++) {
checkbox = arr[i];
if (i == lstNo) {
if (ctrlType == 'anchor') {
if (!checkbox.checked) {
checkbox.checked = true;
}
else {
checkbox.checked = false;
}
}
}
if (checkbox.checked) {
if (selectedItems == "") {
selectedItems = arrlbl[i].innerText;
}
else {
selectedItems = selectedItems + "," + arrlbl[i].innerText;
}
noItemChecked = noItemChecked + 1;
}
}
ddlReport.title = selectedItems;
var Text = ddlReport.options[ddlReport.selectedIndex].text;
if (noItemChecked == 1)
ddlReport.options[ddlReport.selectedIndex].text = lstValue;
else
ddlReport.options[ddlReport.selectedIndex].text = noItemChecked + " Items";
document.getElementById('hidList').value = ddlReport.options[ddlReport.selectedIndex].text;
}
document.onclick = check;
function check(e) {
var target = (e && e.target) || (event && event.srcElement);
var obj = document.getElementById('divChkList');
var obj1 = document.getElementById('ddlChkList');
if (target.id != "alst" && !target.id.match("chkLstItem")) {
if (!(target == obj || target == obj1)) {// || target == obj2)) {
obj.style.display = 'none'
}
else if (target == obj || target == obj1) {// || target == obj2) {
if (obj.style.display == 'block') {
obj.style.display = 'block';
}
else {
obj.style.display = 'none';
document.getElementById('ddlChkList').blur();
}
}
}
}
</script> |
Partager