Wednesday, December 28, 2011

Click a button show a massage through an alert box

Example: When you click the button the message will display through an alert box.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>button</title>
<script language="javascript">
function showMsg(msg) {
alert("The button sent:" + msg)
}

</SCRIPT>
</head>

<body>
<center>
<h3>When you click the button the message will display through an alert box</h3>
<form>
<input type="button" value="click me" onclick="showMsg('The button has been clicked.')" />
</form>
</center>
</body>
</html>

3 comments: