Describe how DHTML work with JavaScript.
As DHTML is not a language and it just use the property of HTML, JavaScript and CSS to make dynamic content. So here I will represents the working of DHTML with JavaScript with a simple example that just greets user with its name:
<! DOCTYPE html PUBLIC "-//abc//DTD XHTML 1.1//EN" "http://www.abc.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.abc.org/1999/xhtml">
<head>
<title>DHTML example</title>
<script type="text/JavaScript">
function greet_user()
{
var name=document.getElementById(“userName”).value;
if(name==””)
{
alert(“Welcome”+name);
}
else
{
alert(“Please provide User Name”)
}
}
</script>
</head>
<body>
<table border=”1” cellspacing=”3”>
<tr>
<td colspan=”2”><h6> Please Enter Your Name </h6></td>
</tr>
<tr>
<td><h4>User Name </h4></td>
<td><input type=”text” id=”userName” ></td>
</tr>
<tr>
<td colspan=”2”><input type=”button” value=”Submit” onclick=”greet_user()”/>
</table>
</body>
</html>