下面就把代碼貼出來。
第一設(shè)置CSS
<style type="text/css">
.selectName
{
margin-left: 30%;
width: 150px;
height: 150px;
margin-top: 30px;
position: absolute;
background-color: #eef6ff;
z-index: 0;
display: none;
}
</style>
第二是DIV
<!--DIV 默認(rèn)隱藏-->
<div id="divBatchName" class="selectName">
<div style="height: 50px; margin-top: 20px;">
<label>
批次名稱</label>
<asp:DropDownList ID="ddlSelectBatchName" runat="server" AutoPostBack="true" >
</asp:DropDownList>
</div>
<div style="margin-top: 20px">
<asp:Button ID="btnDivBatchSure" runat="server" Text="確定" CssClass="btn_bg" ToolTip="確定"
OnClientClick="divHideBatchName()" />
</div>
</div>
<!--End DIV 默認(rèn)隱藏-->
第三 JS腳本
<script language="javascript" type="text/javascript">
//顯示 div
function divShowBatchName() {
var showBatchName = document.getElementById("divBatchName");
showBatchName.style.display = 'block';
}
//隱藏 div
function divHideBatchName() {
var hideBatchName = document.getElementById("divBatchName");
hideBatchName.style.display = 'none';
}
</script>
觸發(fā)顯示DIV服務(wù)器控件
<asp:Button ID="btnGivenBatch" runat="server" Text="顯示DIV" OnClientClick="divShowBatchName()" />
就這些代碼 ,樣式大家可以自行設(shè)計(jì)。
如對(duì)本文有疑問,請(qǐng)?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會(huì)為你解答?。?點(diǎn)擊進(jìn)入論壇