View Single Post
  #1 (permalink)  
Old 12-02-2006, 10:45 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default JavaScript:Tutorial, Confirmation Box

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:-

Code:
<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:-
Code:
<body onLoad="Confirm_Ok_Cancel()">
Explanation:-
I think it's self explanatory no need of explanations!

A Preview:-


Conclusion:-
As Always Feedback is welcome and the full source is attached!!
Attached Files To view attachments in this forum your post count must be 1 or greater. You currently have 0 posts.

Last edited by TcM; 12-03-2006 at 07:30 AM.
Reply With Quote

Sponsored Links