Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Change confirm dialog box button label from "Ok" to "Yes"

    Hi,

    In my project i am using java script confirm dialog box and i want to change label from "ok" to "yes" and "cancel" to "no"

    We can see "Ok" "Cancel' label button on dialog box.

    Could you please tell me it is possible to change, if not any other way to change?


    Thanks in advance.

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Posts
    165
    Thanks
    1
    Thanked 39 Times in 39 Posts
    That should be a fairly easy fix. If you post your code, I can show you what/where you need to edit.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,092
    Thanks
    23
    Thanked 593 Times in 592 Posts
    I do not think you can change the confirm dialog box button dialog, but you can make your own confirmation box:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>New document</title>
    <style type="text/css">
    div#fake_box{
    	position: absolute;
    	top: 100px;
    	left: 200px;
    	height: 88px;
    	width: 200px;
    	border: solid black 2px;
    	background-color: gray;
    	color: black;
    	text-align:center;
    	display:none;
    }
    </style>
    <script type="text/javascript">
    function show_box()
    {
        document.getElementById("fake_box").style.display = "block";
    }
    
    </script>
    </head>
    
    <body>
    <button onclick="show_box()">A question</button>
    <div id="fake_box">
    	<br>What are you wearing<br><br>
    	<button style="float:left;">Yes</button>
    	<button style="float:right;">No</button>
    </div>
    
    </body>
    </html>

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,620
    Thanks
    0
    Thanked 645 Times in 635 Posts
    You should always make your own dialog boxes in JavaScript - the built in ones are only there for debugging purposes.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •