【问题标题】:popup confirm window with scrollbars带有滚动条的弹出确认窗口
【发布时间】:2011-10-27 12:01:14
【问题描述】:

我有一个按钮,我需要一个确认弹出窗口。

这就像用户点击是或否的协议。

白色面板中有数据,下面有两个按钮。

数据很大,所以我需要在数据所在的面板中使用滚动条。

这在 winform 应用程序中很容易做到,但现在我正在使用 web 应用程序。 我通常使用 javascript 或 Ajax 显示弹出确认..

这是 AJAX 中的代码:

<p style="background-color: #D0D8E8; text-align: right; padding-right: 20px;">
    <asp:Button class="buttonStyle"  ID="Update1" runat="server" Text="Update" 
        onclick="Update1_Click" CausesValidation="true" />

    <cc1:ConfirmButtonExtender ID="Update1_ConfirmButtonExtender" runat="server" 
        ConfirmText="Are you sure you want to make changes in config file?&#10;Please restart 'Copiun Backup Server' service for changes to take effect." 
        Enabled="True" TargetControlID="Update1">
    </cc1:ConfirmButtonExtender>
   </p>

这就是我在 javascript 中所做的:

<script type="text/javascript">
function OnConfirm() {
if (confirm("Are you sure you want to reset?")) {       
    return true;
} else {
    return false;
}

}

请帮忙..谢谢

【问题讨论】:

    标签: c# asp.net web-applications popup confirmbutton


    【解决方案1】:

    您最好创建自己的确认对话框。使用标准的确认对话框会在大量数据时看起来非常丑陋,甚至在使用滚动条时会更丑陋。您可以使用 AJAX Toolkit 附带的模态弹出对话框,也可以使用 jQuery UI 对话框之类的工具。

    这里是 jQuery UI 对话框的链接:

    http://jqueryui.com/demos/dialog/

    【讨论】:

      【解决方案2】:

      来自here

      设置焦点可能会将其滚动到视图中(未测试),在 if 之前将其添加到您的 js 中:

      document.getElementById('fieldId').focus()
      

      该页面上还有一些很酷的东西:

      “这会将光标发送到未完成的字段并将该字段变为粉红色。”

      if (document.yourform.fieldname.value == "") {
          alert("You have not filledin this field.");
          document.yourform.fieldname.focus();
          if(document.all || document.getElementByID){
          document.yourform.fieldname.style.background = "pink";
      }
          return false;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-09-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-22
        • 2013-01-21
        相关资源
        最近更新 更多