一个类似Listview的效果

一个类似Listview的效果 
 
<title>列表</title> 
<style> 
<!-- 
body { font-size: 10px } 
table { font-size: 12px } 
--> 
</style> 
<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> 
<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> 
<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 
</script> 
<body onload = 'InitList(myList, myTale, 4, 5, false)' scroll = 'no' bgcolor = 'buttonface' topmargin='0' leftmargin='0'> 
<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='100%' height='100%'> 
<tr> 
<td nowrap> 
<script language = 'javascript'> 
document.write( "<object classid='clsid:BDD1F04B-858B-11D1-B16A-00C0F0283628' style = 'width:" + (document.body.clientWidth - 150) + ";height:" + document.body.clientHeight + "' id='myList'></object> ") 
</script>


<table border = '1' id = 'myTale' style = 'display:none'> 
<tr id = 'tablehead'> 
<td id = 'mytd'> 
编号 
</td> 
<td id = 'mytd'> 
名称 
</td> 
<td id = 'mytd'> 
价格 
</td> 
<td id = 'mytd'> 
备注 
</td> 
<td id = 'mytd'> 
编号 
</td> 
</tr> 
<tr id = 'mytr'> 
<td id = 'mytd'> 
101 
</td> 
<td id = 'mytd'> 
53度特酿 
</td> 
<td id = 'mytd'> 
186 
</td> 
<td id = 'mytd'> 
1*6 
</td> 
<td id = 'mytd'> 
16 
</td> 
</tr> 
<tr id = 'mytr'> 
<td id = 'mytd'> 
102 
</td> 
<td id = 'mytd'> 
52趵突泉特酿 
</td> 
<td id = 'mytd'> 
128 
</td> 
<td id = 'mytd'> 
1*6 
</td> 
<td id = 'mytd'> 
17 
</td> 
</tr> 
<tr id = 'mytr'> 
<td id = 'mytd'> 
103 
</td> 
<td id = 'mytd'> 
39度精品趵突泉特酿 
</td> 
<td id = 'mytd'> 
60 
</td> 
<td id = 'mytd'> 
1*6 
</td> 
<td id = 'mytd'> 
18 
</td> 
</tr> 
<tr id = 'mytr'> 
<td id = 'mytd'> 
104 
</td> 
<td id = 'mytd'> 
34度趵突泉特酿 
</td> 
<td id = 'mytd'> 
45.8 
</td> 
<td id = 'mytd'> 
1*6 
</td> 
<td id = 'mytd'> 
19 
</td> 
</tr> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值