gpt4 book ai didi

javascript - 不使用 asp.net 按钮关闭 jQuery 弹出窗口

转载 作者:行者123 更新时间:2023-11-28 09:13:41 28 4
gpt4 key购买 nike

当我点击发送按钮时,我的弹出窗口关闭,但我需要此窗口保持打开状态.. 如果你能帮助我,请帮助我 - 谢谢!

<%@ 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> &nbsp;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>

最佳答案

如果您希望提交表单并保持在同一页面,您应该通过 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
});

关于javascript - 不使用 asp.net 按钮关闭 jQuery 弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26394488/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com