popup confirm window with scrollbars
i have a button where i need the a confirm popup.
this is like an agreement for the user to click Yes or NO.
there is data in the white panel and two buttons below.
the data is huge so i will be requiring scroll bars in the panel where the data is.
this was very easy to do in winform applications but now i am working with webapplications. i normally show the popup confirm using javascript or Ajax..
here is that code in 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>
this is what i do in javascript:
<script type="text/javascript">
function OnConfirm() {
if (confirm("Are you sure you want to reset?")) {
return true;
} else {
return false;
}
}
开发者_高级运维Please help.. thanks
You would be better off creating your own confirm dialog. Using the standard confirm dialog will look really ugly with a lot of data, and even uglier with scrollbars. You can use the modal poup dialog that comes with the AJAX Toolkit, or you could use something like the jQuery UI dialog.
Here is a link to the jQuery UI dialog:
http://jqueryui.com/demos/dialog/
From here:
Setting the focus might scroll it into view(not tested), add this to your js before the if:
document.getElementById('fieldId').focus()
Something else cool on that page:
"This sends the cursor to the field that was not complete and turns the field pink."
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;
}
精彩评论