当我点击发送按钮时,我的弹出窗口关闭,但是我需要这个窗口保持打开状态..如果你可以帮助我,请谢谢!
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication23.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link type="text/css" href="css-js/StyleSheet1.css" rel="stylesheet" />
<link rel="stylesheet" href="NewFolder1/Style.css" type="text/css" />
<script type="text/javascript" src="css-js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="css-js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="css-js/jquery.validate.js"></script>
<script type="text/javascript" src="NewFolder1/jquery.js"></script>
<script type="text/javascript" src="NewFolder1/custom.js"></script>
<script>
$("document").ready(function()
{
$("#thumb").click(function () {
$("#ovelay").fadeIn("slow");
$("#overlay_div").fadeIn("slow");
});
$(".close_button").click(function () {
$("#overlay").fadeOut("fast");
$("#overlay_div").fadeOut("fast");
})
});
</script>
<script type="text/javascript" src="css-js/validate.js"></script>
</head>
<body>
<div>
<img src="css-js/66.jpg" alt="" id="thumb"/></div>
/>
<div id ="overlay">
</div>
<div id = "overlay_div" style="background-color:#B5E655;opacity: 0.83;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity = 67);
/*-ms-filter must come before filter*/
filter: alpha(opacity = 67);
/*INNER ELEMENTS MUST NOT BREAK THIS ELEMENTS BOUNDARIES*/
/*All filters must be placed together*">
<div>
<div id="container" style="margin-top:30px ; margin-left:0px"">
<h1> Contact Me</h1>
<form id="contact_form" runat="server">
<div>
<label for="name" >Name</label>
<input id="name" type="text" />
<span id="nameinfo">what's your name?</span>
</div>
<div>
<label for="pass2">Téléphone</label>
<input id="pass2" name="pass2" type="password" />
<span id="pass2info"></span>
</div>
<div>
<div>
<label for="email">E-mail</label>
<input id="email" name="email" type="text" />
<span id="emailinfo">so i can get back to you</span>
</div>
<label for="message">what's wanna tell me?</label>
<textarea id="message" name="message" > </textarea>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="send" OnClick="send_Click" ValidateRequestMode="Enabled" />
</div>
</form>
</div>
</div>
<!-- a problem is here -->
<div id = "close_button" class= "close_button"> X </div>
</div>
</body>
</html>
答案 0 :(得分:0)
如果您希望提交表单并保留在同一页面,则应通过AJAX提交信息。
$('button').on('click', function() {
$.ajax({ method: 'POST', data: $('#contact_form').serialize()})
.done(function() {
//Successful AJAX call callback
});
});
如果您打算使用提交按钮,则必须阻止它通过传统方法发送数据。
$('button').on('click', function(ev) {
ev.preventDefault(); //Prevents data submission
});