Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

prompt boxes

Question posted by: nuno silva (Guest) on July 20th, 2005 09:48 AM
i'm new to javascript, and so I'd like to know if there's a way to make
a prompt box, that, instead of having "ok" "cancel" and a text box,
would just have buttons of "yes" "no".

Is there a method that can do it?

Lasse Reichstein Nielsen's Avatar
Lasse Reichstein Nielsen
Guest
n/a Posts
July 20th, 2005
09:48 AM
#2

Re: prompt boxes
nuno silva <topolino@netvisao.pt> writes:
[color=blue]
> i'm new to javascript, and so I'd like to know if there's a way to
> make a prompt box, that, instead of having "ok" "cancel" and a text
> box, would just have buttons of "yes" "no".[/color]

You are probably looking for the "confirm" function instead of "prompt".
You can not decide what text is on the buttons.
<URL:http://jibbering.com/faq/#FAQ4_28>

/L
--
Lasse Reichstein Nielsen - Join Bytes!
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'

nuno silva's Avatar
nuno silva
Guest
n/a Posts
July 20th, 2005
09:49 AM
#3

Re: prompt boxes
ok... I've done it. that's what I wanted. Now tell me something:

when I press ok button what result should go to a local variable?
i'm asking?
if (option == okbutton) do this ----> what should be the value instead
of okbutton?
else do that...


Lasse Reichstein Nielsen wrote:[color=blue]
> nuno silva <topolino@netvisao.pt> writes:
>
>[color=green]
>>i'm new to javascript, and so I'd like to know if there's a way to
>>make a prompt box, that, instead of having "ok" "cancel" and a text
>>box, would just have buttons of "yes" "no".[/color]
>
>
> You are probably looking for the "confirm" function instead of "prompt".
> You can not decide what text is on the buttons.
> <URL:http://jibbering.com/faq/#FAQ4_28>
>
> /L[/color]


Lasse Reichstein Nielsen's Avatar
Lasse Reichstein Nielsen
Guest
n/a Posts
July 20th, 2005
09:49 AM
#4

Re: prompt boxes
nuno silva <topolino@netvisao.pt> writes:
[color=blue]
> ok... I've done it. that's what I wanted. Now tell me something:
>
> when I press ok button what result should go to a local variable?
> i'm asking?
> if (option == okbutton) do this ----> what should be the value
> instead of okbutton?[/color]

I am not sure I understand the question.

The way I use the confirm function is

if (confirm("Should we go on?")) {
//do something on OK
} else {
//do something else on Cancel
}

The confirm function returns a boolean, either true or false,
depending on which button you pressed.

/L
--
Lasse Reichstein Nielsen - Join Bytes!
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'

 
Not the answer you were looking for? Post your question . . .
189,088 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors