Code for Adding Message and Confirmation Boxes Using
JavaScript?
Answer Posted / sivasubramanian.k
<html>
<head>
<script>
function message()
{
var str;
str="Click Ok to continue!!!";
alert(str);
}
function confirmation()
{
var str;
str="Are you sure to delete?Then click Ok or Cancel!!!";
confirm(str);
}
</script>
</head>
<body>
<form>
<h3>Click the button below which shows message box</h3>
<input type="submit" value="Click Me" name="submit"
onClick="return message()">
<h3>Click the button below which shows confirmation box</h3>
<input type="submit" value="Delete" name="delete"
onClick="return confirmation()">
</form>
</body>
</html>
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
Reading which Non-Character Key was pressed
code to detect availability of cookies
code to positioning of window in certain dimensions
how to Scroll a DIV content
determine which Element received an Event
program to bring a window to the front
maximizing the main window
code to keep a page Out of the browser history
Create a Menu that can be activated while clicking on Right Mouse button
code to create a new window
how to create Expandable and Collapsible Menus
code to detect versions of different browsers like internet explorer, netscape, mozilla, opera etc
sample code to auto focusing the first field in a form
snippet to prevent submission of form when certain/any validations got failed
how to Auto Scroll the page