有人能告诉我为什么我的模态弹出窗口中的警报按钮在我点击警报确定按钮后关闭弹出窗口。这是我的精简代码。
<script type="text/javascript">
function myFunction() {
alert("Hello! I am an alert box!");
}
</script>
<! -- language: lang-html -->
<style type="text/css">
#popupBoxTwoPosition{
top: 0; left: 0; position: fixed; width: 100%; height: 120%;
background-color: rgba(0,0,0,0.7); display: none;
.popupBoxWrapper{
width: 550px; margin: 50px auto; text-align: left;
}
.popupBoxContent{
background-color: #FFF; padding: 15px;
}
</style>
<div id="popupBoxTwoPosition">
<div class="popupBoxWrapper">
<div class="popupBoxContent">
<form runat="server">
<h3>Popup Box 2</h3>
<p>You are currently viewing popup box 9.</p>
<asp:TextBox id="txt" runat="server" />
<p>
<asp:Button ID="Button2" runat="server" Text="Close" OnClientClick="myFunction()" />
</p>
<%--<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="toggle_visibility('popupBoxTwoPosition')" />--%>
<%--<p>Click <a href="javascript:void(0)" onclick="toggle_visibility('popupBoxTwoPosition');">here</a> to close popup box two.</p>--%>
</form>
</div>
</div>
</div>
<div id="wrapper">
<p>Click <a href="javascript:void(0)" onclick="toggle_visibility('popupBoxTwoPosition');">here</a> to see popup box two.</p>
</div><!-- wrapper end -->
&#13;
我在javascript弹出窗口中表现不佳 - 最终我想将数据从文本框返回到代码后面 - 对此有任何想法吗?谢谢笔