Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alert boxes

Status
Not open for further replies.

teroy

Programmer
Oct 17, 2000
67
AU
hi there. i have the following code

<snip>
<FORM name=&quot;&quot; method=&quot;post&quot; action=&quot;script.cgi&quot; onSubmit=&quot;return checkform()&quot;>
<snip>
function checkform()
{

}

My question is..I would like to have an alert box with the options yes or no. And upon clicking no the function returns false and therefore the script does not get executed.
Thanks in Advance

Troy
 
You want to use a confirm box:

var yes = self.confirm(&quot;Are you sure?&quot;);

If OK clicked the var holds true, otherwise false.
b2 - benbiddington@surf4nix.com
 
Hi friend,

You should use the &quot;confirm(msg)&quot; instead of &quot;alert(msg)&quot;. This is an example:

<script language=&quot;JavaScript&quot;>
var name = confirm(&quot;Press a button&quot;)
if (name == true)
{
document.write(&quot;You pressed OK&quot;)
}
else
{
document.write(&quot;You pressed Cancel&quot;)
}
</script>

Hope it matches your request!
Regards
Tuy Le
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top