2011-08-15 219 views
0

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

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

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

数据很大,所以我会要求面板中的数据所在的滚动条。

这在winform应用程序中很容易做到,但现在我正在使用web应用程序。 我正常显示使用JavaScript或阿贾克斯弹出的确认..

这里是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; 
} 

}

请帮忙..谢谢

回答

1

您最好创建自己的确认对话框。使用标准确认对话框对于大量数据看起来会非常难看,甚至对于滚动条来说更丑陋。您可以使用AJAX Toolkit附带的模式poup对话框,或者您可以使用类似jQuery UI对话框的东西。

下面是对jQuery UI对话框的链接:

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

1

here

设置对焦可能把它的滚动到视图(未测试),这个如果说之前添加到您的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; 
}