Wednesday, February 22, 2012

Change page content using DHTML


This program will change HTML page content dynamically using JavaScript. 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
function change()
{
 document.getElementById("myp").innerHTML="<font color=red>Changed</font>";

}

</script>
</head>

<body>
<form name="myform" method="post" onSubmit="abc()">
<p id="myp" onClick="change()"> Click me to change me</p>
</form>
</body>
</html>

No comments:

Post a Comment