[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Message box having Yes and No Buttons instead of Ok and Cancel buttons

Posted on 2004-10-26
4
Medium Priority
?
10,558 Views
Last Modified: 2012-08-13
Hi
I would like to know whether we can have a message box with Yes and No Buttons in Javascript. I am aware of the confirm message box having OK and Cancel Buttons, but my requirements is for a message box with Yes and No buttons. I am aware that we can define the number of boxes in a message box using VBScript, but i have to give the same functionality using Javascript. Please help asap.

Regards

Prashant
0
Comment
Question by:pvasha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 33

Accepted Solution

by:
sajuks earned 1200 total points
ID: 12408910
You can have the confirm box (as you already know) .The other alternative might be calling a modal
window ( that you create ) and use it.Other alternative being vbscript
0
 
LVL 33

Assisted Solution

by:sajuks
sajuks earned 1200 total points
ID: 12408923
//Check this, a code posted by another expert in this forum
<script language="JavaScript">
     function alertBox(alertMessage,height,width)
          {
          // This stuff centers the window
          windowWidth = (width == null) ? 200 : width; // width of the new window
         windowHeight = (height == null) ? 30 : height; // height of the new window
         windowLeft = (screen.width / 2) - (windowWidth / 2); // center the window right to left
         windowTop = (screen.height / 2) - (windowHeight / 2); // center the window top to bottom
         
          // the values get inserted into the features parameter of the window.open command...
          var windowLocation = "top=" + windowTop + ",left=" + windowLeft + ",height=" + windowHeight + ",width=" + windowWidth;
          alertWindow = window.open("","alertWindow",windowLocation);
          alertWindow.document.write("<html><head><title>Alert!</title></head><body bgcolor='#C0C0C0'>");
          alertWindow.document.write("<div align='center'>" + alertMessage + "<br>");
          alertWindow.document.write("<form><input type='button' value=' YES ' onclick='window.close()' align='center'></form>");
          alertWindow.document.write("</div></body></html>");
          }
</script>


// Here is the call:
<input type="button" value="test" onclick="alertBox('This is an alert!!!')">
0
 
LVL 3

Assisted Solution

by:andYetAnotherLoginName
andYetAnotherLoginName earned 150 total points
ID: 12408961
change
         alertWindow.document.write("<html><head><title>Alert!</title></head><body bgcolor='#C0C0C0'>");

to
         alertWindow.document.write("<html><head><title>Alert!</title></head><body bgcolor='buttonface' style='border:0px none'>");

for better appearence.
0
 
LVL 5

Assisted Solution

by:mrielf
mrielf earned 150 total points
ID: 12409613
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question