就是将可以多项选取的checkbox放到一个list列表中,可以滚动list来选择checkbox!

解决方案 »

  1.   

    gaofaq(老高):举个例子可以吗?感谢!
      

  2.   

    给你个demo吧,写的比较简单,一个思路而已<META http-equiv="Content-Type" content="text/html; charset=gb2312">
    <STYLE>
    #simulateDiv
    {
    border: 1px solid black;
    width:150px;
    height:20px;
    margin:0px;
    padding:0px;
    font-size:12px
    }
    #content
    {
    border-left:1px solid black;
    border-right:1px solid black;
    border-bottom:1px solid black;
    width:150px;
    height:180px;
    margin:0px;
    padding:0px;
    position:absolute;
    overflow:auto;
    }
    </STYLE>
    <SCRIPT language="javascript">
    function showDiv()
    {
    if(content.style.display == "none")
    content.style.display = "";
    else
    content.style.display = "none";
    }
    function getData()
    {
    var arrData = new Array();
    var index = 0;
    for(var i=0; i<conTable.rows.length; i++)
    {
    var oChkCell = conTable.rows[i].cells[0];
    var oTxtCell = conTable.rows[i].cells[1];

    if(oChkCell.children[0].checked == true)
    {
    arrData[index++] = oTxtCell.innerText;
    }
    }
    var strData = arrData.join("|");
    spanContent.innerText = strData;
    content.style.display = "none";
    }
    </SCRIPT>
    <DIV id="simulateDiv">
    <SPAN style="width:130px;" id="spanContent"></SPAN>
    <SPAN style="width:18px; cursor:hand; font-family:webdings; font-size:14px; padding-left:2px; background-color:#33CCFF; border-left:1px solid black" onClick="showDiv()" onselectstart="return false;">6</SPAN>
    </DIV>
    <DIV id="content" style="display:none">
    <TABLE cellpadding="0" cellspacing="0" border="0" style="font-size:12px" id="conTable">
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>one</TD></TR>
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>two</TD></TR>
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>three</TD></TR>
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>four</TD></TR>
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>five</TD></TR>
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>six</TD></TR>
    <TR><TD><INPUT type="checkbox" id="chk"></TD><TD>seven</TD></TR>
    </TABLE><BR>
    <TABLE cellpadding="0" cellspacing="0" border="0" align="center">
    <TR><td align="center"><A onClick="getData()" style="font-size:12px; cursor:hand">确定</A></Td>
    </TABLE>
    </DIV>