Hello , Can Anybody please Give me An Example of Javascript OK/Cancel Message Box , I am Learning Java and Want to Write a small Program With Has this message box Please Help Thanks in Advance
Hello , Can Anybody please Give me An Example of Javascript OK/Cancel Message Box , I am Learning Java and Want to Write a small Program With Has this message box Please Help Thanks in Advance
You Can Check this Code
<html>
<head>
<title>
Test JavaScript Confirm
</ title>
<SCRIPT Language="JavaScript">
<--
securit function ()
(
if (confirm ( 'Do you want to visit the laboratory and Archeology Territory'))
document.location.href = 'Techarena.in'
)
->
</ SCRIPT>
</ head>
<body onLoad="securit()">
Page content
</ body>
</ html>
</ body>
</ html>
This Code might ALso work
<HTML>
<HEAD>
<script Language="JavaScript">
<!--
function checkfields(form)
{
if(confirm("You left some fields empty. Are you sure you want to continue."))
return true;
else
return false;
}
-->
</SCRIPT>
</HEAD>
<BODY>
<TABLE>
<FORM NAME=MyForm ACTION=submit.php3 METHOD="POST" onsubmit="return checkfields
(this);">
<TR><TD COLSPAN="2"><INPUT NAME="submit" VALUE="Submit" TYPE="submit"></TD></TR>
</BODY>
</HTML>
Hello , Here a the Structure
if (confirm("Your question)) {
// Code to Execute
}
Example
The button above was created using the following code:
<form name=form2>
<input type=button value="Click Here"
onClick="if(confirm('Go Ahead'))
alert('You Went Ahead!');
else alert('You Did not Went Ahead')">
</form>
Bookmarks