简单的弹出层窗口应用(DIV+JS)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<script language="javascript" type="text/javascript">
//显示写评语
function showDiv()
{
document.all.divShow.style.pixelLeft =300;
document.all.divShow.style.pixelTop = 150;
document.all.divShow.style.display = "block";
return false;
}
//不同意取消
function closeDiv()
{
document.getElementById("<%=txRemark.ClientID %>").value = "";
document.all.divShow.style.display = "none";
return false;
}
//不同意确定按钮前判断
function fun_Enter()
{
var _val = document.getElementById("<%=txRemark.ClientID %>").value;
if(_val == "")
{
alert("<%=res.GetResource("SYS.REPORTS_GGEC.TEXT1")%>");
return false;
}
else
{
document.all.divShow.style.display = "none";
return true;
}
}
</script>
代码
//显示写评语
function showDiv()
{
document.all.divShow.style.pixelLeft =300;
document.all.divShow.style.pixelTop = 150;
document.all.divShow.style.display = "block";
return false;
}
//不同意取消
function closeDiv()
{
document.getElementById("<%=txRemark.ClientID %>").value = "";
document.all.divShow.style.display = "none";
return false;
}
//不同意确定按钮前判断
function fun_Enter()
{
var _val = document.getElementById("<%=txRemark.ClientID %>").value;
if(_val == "")
{
alert("<%=res.GetResource("SYS.REPORTS_GGEC.TEXT1")%>");
return false;
}
else
{
document.all.divShow.style.display = "none";
return true;
}
}
</script>
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!---层内容---->
<div id="divShow" style="display: none; position: absolute; border: solid 1px black">
<fieldset>
<legend>
<%=res.GetResource("SYS.REPORTS_GGEC.TEXT1")%>
</legend>
<table id="DivTable" width="300px">
<tr>
<td>
<%=res.GetResource("SYS.REPORTS_GGEC.TEXT2")%>
</td>
<td align="right">
<asp:TextBox ID="txRemark" runat="server" SkinID="rem" Width="250px" Height="100px"
TextMode="multiLine"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnEnter" runat="server" SkinID="Button" Text="确定" OnClientClick="jscript:return fun_Enter();"
OnClick="btnEnter_Click" />
<asp:Button ID="btnCancel" runat="server" SkinID="Button" Text="取消" OnClientClick="jscript:return closeDiv();" />
</td>
</tr>
</table>
</fieldset>
</div>
<div id="divShow" style="display: none; position: absolute; border: solid 1px black">
<fieldset>
<legend>
<%=res.GetResource("SYS.REPORTS_GGEC.TEXT1")%>
</legend>
<table id="DivTable" width="300px">
<tr>
<td>
<%=res.GetResource("SYS.REPORTS_GGEC.TEXT2")%>
</td>
<td align="right">
<asp:TextBox ID="txRemark" runat="server" SkinID="rem" Width="250px" Height="100px"
TextMode="multiLine"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnEnter" runat="server" SkinID="Button" Text="确定" OnClientClick="jscript:return fun_Enter();"
OnClick="btnEnter_Click" />
<asp:Button ID="btnCancel" runat="server" SkinID="Button" Text="取消" OnClientClick="jscript:return closeDiv();" />
</td>
</tr>
</table>
</fieldset>
</div>