弹出确认窗口与滚动条
本文关键字:滚动条 窗口 确认 | 更新日期: 2023-09-27 18:05:44
我有一个按钮,我需要一个确认弹出。
这就像是用户点击Yes或NO的协议。
白色面板上有数据,下面有两个按钮。
数据是巨大的,所以我将需要滚动条在面板上的数据。
这在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? 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;
}
}
请帮. .由于
您最好创建自己的确认对话框。使用标准的确认对话框,如果有大量的数据,看起来会很难看,如果有滚动条,就更难看了。你可以使用AJAX工具箱自带的模态弹出对话框,或者你也可以使用jQuery UI对话框。
下面是jQuery UI对话框的链接:
http://jqueryui.com/demos/dialog/从这里:
设置焦点可能会将其滚动到视图中(未测试),将此添加到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;
}