[英]How to Reopen pure CSS3 modal dialog
I have following Modal Dialog (popup) using only CSS3 in my asp page for user registration: HTML : 我在asp页面中仅使用CSS3进行以下“模式对话框”(弹出窗口)进行用户注册: HTML:
<%-- Modal PopUp starts here--%>
<div id="openModal" class="modalDialog">
<div> <a href="#close" title="Close" class="close" onclick="DisableAllPopUpTxt()">X</a>
<table style="width:100%;">
<tr>
<td style="text-align: center; width: 100%;"></td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<asp:Label ID="lblErrorMSG2" runat="server" Font-Bold="True" ForeColor="#FF3300" Text="Email ID Already Taken " Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustFName" name="txtCustFName" type="text" required placeholder="Enter Your First Name" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustLName" name="txtCustLName" type="text" required placeholder="Enter Your Last Name" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustREmail" name="txtCustREmail" type="email" required placeholder="Enter Valid Email ID" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustRPwd" name="txtCustRPwd" type="password" required placeholder="Enter Password" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustRePwd" name="txtCustRePwd" type="password" required placeholder="ReType Password" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustPh" name="txtCustPh" type="number" size="10" min="10" max="10" required placeholder="Enter Valid Mobile No" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td class="style1" style="text-align: center; width: 100%;" onclick="btnSignUp()">
<asp:Button ID="btnSingUp" runat="server" onclick="signUp" Text="Login" />
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;"> </td>
</tr>
</table>
</div>
</div>
<%--Modal PopUp Ends Here--%>
CSS : CSS:
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;}
.close:hover { background: #00d9ff;
}
In my asp page I've following anchor tag which is used to display the popup: 在我的asp页面中,我遵循了用于显示弹出窗口的锚标记 :
Register 寄存器
Now the problem is: 现在的问题是:
As this is registration form, I want server side validation of existing email id . 由于这是注册表格,因此我需要服务器端对现有电子邮件ID进行验证。 If user entered email id already exist in DB I want to reopen the above modal dialog with an error message Email ID already exist. 如果用户输入的电子邮件ID已存在于数据库中,我想重新打开上述模式对话框,并显示一条错误消息“电子邮件ID”。
I m not able to reopen that dialog box. 我无法重新打开该对话框。 Is there any way to do this using js? 有没有办法使用js做到这一点? Plz help me. 请帮我。
The tutorial for modal dialog is on site: click here 模态对话框的教程在网站上: 单击此处
For visualizing modal dialog: click here 可视化模式对话框: 单击此处
Thanx in advance. 提前感谢。
for server side validation I suggest you to use javascript web method for this. 对于服务器端验证,我建议您为此使用javascript web方法。 By using this web method your popup didn't close while page check server side validation..... 通过使用此网络方法,您无法在页面检查服务器端验证时关闭弹出窗口。
Change the :target to also accept a class: 更改:target以也接受一个类:
.modalDialog:target, .modalDialog.target {
opacity:1;
pointer-events: auto;
}
And then when you find out the email is invalid, you can just do: 然后,当您发现电子邮件无效时,您可以执行以下操作:
$('.modalDialog').addClass('target')
or the non-jquery equivalent. 或非jQuery等效项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.