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


Please Help Members By Posting Answers For Below Questions

I have a doubt regarding including tags in a function. I have written a function in javascript in a html page. The function got called by clicking a button, i want to display the results in same html page by placing tags in the function. (this hmtl page is static page) Is this possible? example:


code to keep a page Out of the browser history

1653


how to create Expandable and Collapsible Menus

2656


How to encode and decode URL strings?

1792


code to detect availability of cookies

1784


sample code to auto focusing the first field in a form

2033


code to detect versions of different browsers like internet explorer, netscape, mozilla, opera etc

1738


how to pass data between pages using Frames

2147


communication between main window and new windows

1701


code to create a new window

1754


code to set the main window's size

1706