<script language = 'javascript'>
function InitList(theList, theTable, iEnd, iId, checkIt)
{
var colWidth = (document.body.clientWidth - 200) / iEnd
with(theList)
{
View = 3
BorderStyle = 0
GridLines = true
Checkboxes = checkIt
FullRowSelect = true
LabelEdit = 1
for(var i = 0; i < iEnd; i ++)
{
ColumnHeaders.Add(i + 1, 'Col' + i, theTable.rows[0].cells[i].innerText, colWidth) //, 100, myAlign)
}
for(var i = 1; i < theTable.rows.length; i ++)
{
myList.ListItems.Add( i, 'Key' + theTable.rows[i].cells[iId -1].innerText.replace(" ", ""), theTable.rows[i].cells[0].innerText.replace(" ", ""))
for(var j = 1; j < iEnd; j ++)
{
ListItems(i).SubItems(j) = theTable.rows[i].cells[j].innerText.replace(" ", "")
}
}
Sorted = true
}
}
<script language = 'javascript' for = 'myList' event = 'ColumnClick(ColumnHeader)'>
if(ColumnHeader.SubItemIndex == myList.SortKey)
{
if(myList.SortOrder == 0) myList.SortOrder = 1
else myList.SortOrder = 0
}
else
{
myList.SortKey = ColumnHeader.SubItemIndex
if(myList.SortOrder == 0) myList.SortOrder = 1
else myList.SortOrder == 0
}
<script language = 'javascript' for = 'myList' event = 'ItemClick(Item)'>
var theValue = ""
theValue = Item.Text + Item.Key
for(i = 1; i <= Item.ListSubItems.Count; i ++) theValue = theValue + "n" + Item.ListSubItems(i).Text
myValue.value = theValue
//显示共选择了多少条
if (myList.MultiSelect){
lblCount.innerHTML = getSelectedCount() + "条"
}else{
lblCount.innerHTML = "1条"
}
<script language = 'javascript' for = 'myList' event = 'DblClick'>
var theValue = ""
theValue = SelectedItem.Text + SelectedItem.Key
for(i = 1; i <= SelectedItem.ListSubItems.Count; i ++) theValue = theValue + "n" + SelectedItem.ListSubItems(i).Text
myValue.value = theValue
alert(theValue);
<script language = 'javascript'>
function getSelectedCount(){
var cnt=0;
for (var i=1;i<=myList.ListItems.Count;i ++){
if (myList.ListItems(i).Selected){
cnt++;
}
}
return cnt;
}
function deleteSelectedItem(){
var cnt=0;
for (var i=1;i<=myList.ListItems.Count;i ++){
if (myList.ListItems(i).Selected){
myList.ListItems.Remove(i);
//myList.ListItems(i).Delete();
cnt++;
}
}
return cnt;
}
<script language = 'javascript'> document.write( " |
<script language = "javascript">
//function chageSize()
//{
//myList.width = document.body.clientWidth - 150
//myList.height = document.body.clientHeight
//alert(document.body.clientWidth - 150)
//setTimeout("chageSize()", 10)
//}
//chageSize()