SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
-
Feb 21, 2001, 10:29 #1
- Join Date
- Jan 2001
- Location
- Alkmaar, Netherlands
- Posts
- 710
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hello All,
In javascript I am able to use 2 commands
alert and confirm.
But alert appears with OK button and confirm appears with OK/Cancel button. But What I need is to show Yes/No button. When they say Yes they will stay in the same page, otherwise they will be forwarded to another page
Is it possible in Javascript or are there any other way then JavaScript?
Thx
-
Feb 21, 2001, 11:16 #2
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
I'm afraid you can't display a Yes/No dialog with JavaScript. You'll need to reword your user prompt so that it makes sense for OK/Cancel (e.g. "Click OK to be forwarded, or CANCEL to stay here.").
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
-
Feb 23, 2001, 17:54 #3
- Join Date
- Jan 2001
- Location
- England
- Posts
- 338
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You could learn some DHTML and make your own.
Drinky
-
Feb 23, 2001, 17:57 #4
-
Feb 23, 2001, 18:25 #5
- Join Date
- Sep 2000
- Location
- United States
- Posts
- 1,921
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
edited to heckle Kyank ;)
Found it! This will pop up a cancel button...
Code:<SCRIPT LANGAUAGE="javascript"> function gocancle() { if (confirm("Are you sure you want to enter HTML Goodies?") ) { window.open('http://www.htmlgoodies.com','htmlgood'); alert("Good choice"); } else { alert("Then you'll stay right here"); window.status='Chicken!'; } } </SCRIPT>
- Uses the confirm() function to display an okay / cancel box
- uses the if statement to see whether the clicked okay or cancel
- If the user clicked okay, the page opens a window and displays a message box.
- If the user clicks cancel, it displays a message in a message box and then in the status bar.
Hope this helps.Kevin, I guess you can do an okay / cancel dialog in JS.
-
Feb 23, 2001, 20:10 #6
- Join Date
- Jul 2000
- Location
- 80,000 feet below the surface
- Posts
- 1,442
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Smells like another tip for the Tech Times Kevin!
-
Feb 23, 2001, 20:13 #7
-
Feb 23, 2001, 22:15 #8
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
<shakes head> You should read the question before heckling, goober. Quoting the original message in this thread:
In javascript I am able to use 2 commands
alert and confirm.
But alert appears with OK button and confirm appears with OK/Cancel button. But What I need is to show Yes/No button.Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
-
Feb 23, 2001, 22:20 #9
- Join Date
- Sep 2000
- Location
- United States
- Posts
- 1,921
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DOH!
My apologies, Kevin.
Foot and Mouth -- The perfect fit when it comes to me, sorry to say.
Yes, you are stuck using OK / Cancel. There HAS to be a way to have a yes / no script! I will go digging.Likely to come up empty, but still digging...
Sorry again, Kevin. I know you're good-natured enough to forgive me.
-
Feb 23, 2001, 22:23 #10
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
There is a way to do it in MSIE only, which allows you to design custom dialogs using VBScript. There's plenty of info on MSDN. Browser compatibility is too great a sacrifice just for changing the labels of two buttons.
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
-
Feb 25, 2001, 10:05 #11
- Join Date
- Jan 2001
- Location
- Alkmaar, Netherlands
- Posts
- 710
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Current solution is
Click on OK if .....
Click on Cancel if ....
thx for your replies
Bookmarks