本文介绍了MessageBox带有yes no或取消按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type = "text/javascript">

    function Confirm()
    {
        var confirm_value = document.createElement("INPUT");
        confirm_value.type = "hidden";
        confirm_value.name = "confirm_value";
        if (confirm("Do you want to save data?")) {
            confirm_value.value = "Yes";
        } else {
            confirm_value.value = "No";
        }
        document.forms[0].appendChild(confirm_value);
    }

</script>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:TextBox ID="TextBox1" runat="server" BackColor="White" BorderColor="White"
BorderStyle="Groove" Width="157px"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" style="font-size: medium; font-weight: 700; font-style: italic" Text="Submit" onclick="Button1_Click" OnClientClick="Confirm()" />







I am using this code when click on Submit Button MessageBox is appear but it does not check Required Field Validator.

推荐答案

<form id="form1" runat="server" onsubmit="Confirm()><br mode=" hold=" /></form></pre><br mode="></form>


这篇关于MessageBox带有yes no或取消按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 14:18