Solved

Yes/No box in Javascript

Posted on 2001-06-12
8
346 Views
Last Modified: 2011-10-03
Is there a Yes/No box in Javascript?  In the past I've used confirm, alert and prompt dialogs and want to use a Yes/No box.  If there is a way to create a Yes/No box please provide the code.  I am interested in creating a Yes/No box for future use on sites.
0
Comment
Question by:rm3
[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
8 Comments
 
LVL 8

Expert Comment

by:bebonham
ID: 6182838
nope, you just named them all...

some experts suggest creating an html popup to do this...

usually, if it so important that ok be yes and cancel be no, this suggestion isn't too good, because the person who is asking wants something very specific...

of course, you know you can get yes/no values back from a confirm() right??

Bob

0
 

Expert Comment

by:kobail
ID: 6182873
Well I agree with bebonham. Since it is difficult to have a yes/no box, why cant you frame the question displayed on the box in such a way that the OK becomes yes and Cancel becomes NO.
For eg: something like "Please press OK for Agreeing and press Cancel for Disagreeing"

Regards.
Kobail
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6183193
There is no yes/no box in javascript.
If you are coding for IE only you can use VBScript like so :

response = msgbox("Would you like to answer this question ?", vbYesNo)

The only other way would be to write a pop-up window that mimicked a yes no dialog, or write a little java applet that produced one.
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
LVL 8

Expert Comment

by:bebonham
ID: 6183623
ozymandias:

Are you the two huge feet that are left, or are you a giant lost to the past :)?


anyways...yes, I have seen some java applets that are exactly like confirm boxes (except not modal) The only way you can tell them apart is that you KNOW there is no yes no confirm box.

that would be a neat solution...

do you know of any code for such?

Bob
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6183654
Not off the top off my head.
But now you mention it I think I might write a little all pupose dialog class just for fun.

Will post the source to this thread if any one is interested.

BTW, never really thought about which ozymandias I am.
I think that today I will be the Adrian Veidt character from The Watchmen.... maybe it'll help me concentrate.

TTFN.
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6183736
:)

yeah, I'm trying to learn java...I'll post a 50 pointer for you in the java ta if you post the code for such an applet.

Bob
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 25 total points
ID: 6186184
Had a look at this.
You can actually create a modal dialog.
The main problem is that any dialogs, frames windows etc that are thrown up by an applet automatically have a status bar saying "Warning : Applet window" added to them in IE.

This would just confuse/frighten users so the best method is just to use the javascript/vbscript alternatives.

If anyone is interested in the different java applets methods for doing this there are a whole load of examples here(http://fag.hials.no/ad10500/J12/J12a.htm). The page is in Norwgian (I think) but it's pretty self-explanatory and the source code is all there.

0
 

Author Comment

by:rm3
ID: 6212575
Thanks,

This was the most useful comment I received
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

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…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

717 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