Jump to content

JavaScript:Tutorial, Confirmation Box

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Introduction:-
Welcome to another JavaScript tutorial of mine..This will code will determine if the user pressed Ok or Cancel :)

Solution:-
This code goes in the <head> tags:-

<SCRIPT language="JavaScript">
function Confirm_Ok_Cancel()
{
 var Ok_Cancel= confirm("Press Ok or Cancel!");
 if (Ok_Cancel== true)
 {
   alert("You pressed Ok");
 }
 else
 {
  alert("You Pressed Cancel");
  }
}
</SCRIPT>
And this as your body:-
<body onLoad="Confirm_Ok_Cancel()">

Explanation:-
I think it's self explanatory no need of explanations!

A Preview:-
Posted Image

Conclusion:-
As Always Feedback is welcome and the full source is attached!!

Attached Files



#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
How can I make the buttons display "Read Now" and "Read Later" rather than "Ok" and "Cancel"?

#3
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
Good for business type sites and when accepting payments, agreeing to agreements, Terms ect.

#4
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

Sidewinder said:

How can I make the buttons display "Read Now" and "Read Later" rather than "Ok" and "Cancel"?

That can't be done as far as I know, you need to say in the Confirmation box for Example "To Read Now press Ok to Read Later press Cancel."

#5
Guest_nfy_*

Guest_nfy_*
  • Guests
Thx

#6
linkdere8

linkdere8

    Newbie

  • Members
  • Pip
  • 2 posts
thx.. it's really help me out of my problem...!