Current location: Hot Scripts Forums » General Web Coding » JavaScript » Display Yes/No Button in Confirm Dialogue


Display Yes/No Button in Confirm Dialogue

Reply
  #1 (permalink)  
Old 07-20-07, 08:04 AM
Mushtaq Mushtaq is offline
New Member
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Display Yes/No Button in Confirm Dialogue

Hi There,

Plz tell me is there any way of displaying yes/no button on confirm dialogue in javascript instead of ok/cancel
Reply With Quote
  #2 (permalink)  
Old 07-20-07, 08:30 AM
pikaz pikaz is offline
Newbie Coder
 
Join Date: Nov 2005
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
well...

Well it depends, If you want to use VBscript which is not supported by firefox see
this link.
Otherwise you are quite limited to what you can do. You could always create a custom "prompt/dialog" using a new page in a small browser window. Other than that I don't think there is a simple way to customize dialogs...
Reply With Quote
  #3 (permalink)  
Old 07-20-07, 09:58 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Nope, it's not possible to use all the combinations of dialogues available in Windows via JavaScript.

Instead of opening a new window, you could simply use an absolutely positioned <div> tag and style it as a dialogue box.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #4 (permalink)  
Old 02-15-10, 07:09 AM
elizas elizas is offline
New Member
 
Join Date: Feb 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
How to display Javascript Yes/No confirm dialog instead of Ok/Cancel in Internet Explorer

Write the following code in your HTML Page.

<script language="javascript" type="text/javascript">
function window.confirm(str)
{
execScript('n = msgbox("'+str+'","4132")', "vbscript");
return(n == 6);
}
</script>

Call the function from the onClientClick event of your button

<asp:Button ID="btnOk" runat="server" OnClientClick="javascript:return confirm('Are you sure to proceed?');" OnClick="btnOk_Click" Text="OK" />

Write the btnOk_Click event in your server side code

protected void btnOk_Click(object sender, EventArgs e)
{

// your code
}
Now your confirmation dialog will show Yes/No instead of Ok/Cancel. If you click Yes, the control will go to the server side method and if you click No, the server side code will not execute.


<<< removed link >>>

Last edited by wirehopper; 02-15-10 at 07:46 AM. Reason: Removed link
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display intro text to article with a "more info" button? Rollo Tamasi PHP 1 07-05-06 08:42 PM


All times are GMT -5. The time now is 11:27 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.