Do some projects are relatively small, and time tight, there are a lot of things have not come to a hasty summary, while this will have a little time to use the previous project to share the knowledge, only for later convenience.
Front page code
Copy Code code as follows:
<!--keyword-->
<div id= "Keywordsdiv" style= "border:2px solid #6FA1D9; Display:none; Position:absolute;
top:0px; left:0px; width:260px; height:120px; Z-index:3; Background-color: #EAF1FD; " >
<div style= "width:260px; height:20px; Background-color: #6FA1D9 ">
<ul style= "Cursor:pointer; line-height:20px; " >
<li style= "Float:right" onclick= "Getcheckvale ()" >[determine]</li><li style= "Float:right"
Onclick= "Closeself ()" >[shutdown]</li></ul>
</div>
<div>
<asp:checkboxlist id= "cblkeywords" runat= "Server" repeatcolumns= "2" >
</asp:CheckBoxList>
</div>
</div>
JS Script
Copy Code code as follows:
Open the Keyword window
function Locking (E)
{
var divleft = E.offsetleft;
var divtop = e.offsettop;
while (e=e.offsetparent)
{
Divleft + = E.offsetleft;
Divtop + = E.offsettop;
}
var divobj = document.getElementById ("Keywordsdiv");
DivObj.style.left = divleft+ "px";
DivObj.style.top = divtop+20+ "px";
DivObj.style.display = "block";
}
Close the Keyword window
function Closeself ()
{
Document.all.keyWordsDiv.style.display = ' None ';
var Objcheck = document.getElementById ("Cblkeywords"). getElementsByTagName ("input");
for (var i = 0; i < objcheck.length; i++) {
document.getElementById ("Cblkeywords_" + i). checked = false;
}
return false;
}
Keyword values
function Getcheckvale ()
{
var Objcheck=document.getelementbyid ("Cblkeywords");
var Objcheck=document.getelementbyid ("Cblkeywords"). getElementsByTagName ("input");
var Objlabel = document.getElementById ("Cblkeywords"). getElementsByTagName ("label")
var txtkeywordsvalue = "";
var m=0
for (Var i=0;i<objcheck.length;i++)
{
if (document.getElementById ("Cblkeywords_" +i). Checked)
{
var idcheck =document.getelementbyid ("Cblkeywords_" +i). id;//The ID of the currently selected checkbox
for (var j = 0;j <objlabel.length;j++)
{
var forvalue=objlabel[j].getattributenode ("for"). Value
if (Forvalue = = Idcheck)
{
M+=1;
for (Var k=0;k<m;k++)
{
if (k==m-1)
{
txtkeywordsvalue+=objlabel[j].innerhtml;
}
Else
{
Txtkeywordsvalue + = "|" +objlabel[j].innerhtml;
Break
}
}
}
}
}
}
document.getElementById ("Txtkeywords"). Value=txtkeywordsvalue;
Document.all.keywordsdiv.style.display= ' None ';
}
Add a button to call JS
Copy Code code as follows:
<asp:textbox id= "txtkeywords" runat= "Server" readonly= "True" class= "INP" ></asp:TextBox>
<input id= "Imgkey" type= "button" runat= "Server" onclick= "Locking (This)" class= "Tailbut" value= "select"/>
Well, the code is so much, click on the button after the pop-up layer, select the check box can really take the value, the following look at the effect bar!