Q: – What is DHTML? What are the features of DHTML?
DHTML stands for Dynamic HTML. The first thing that we need to clear about DHTML is that it is neither a language like HTML, JavaScript etc. nor a web standard. It is just a combination of HTML, JavaScript and CSS. It just uses these languages features to build dynamic web pages. DHTML is a feature of Netscape Communicator 4.0, and Microsoft Internet Explorer 4.0 and 5.0 and is entirely a "client-side" technology.
Features of DHTML:
- Simplest feature is making the page dynamic.
- Can be used to create animations, games, applications, provide new ways of navigating through web sites.
- DHTML use low-bandwidth effect which enhance web page functionality.
- Dynamic building of web pages is simple as no plug-in is required.
- Facilitates the usage of events, methods and properties and code reuse
Q: – Which browsers support DHTML and how will non-supporting browsers handle DHTML?
Version of Netscape navigator and Internet Explorer higher than 4.0 or 4.0 supports DHTML in easy way. But as compared to both browsers Internet Explorer 4.0+ supports the DHTML in the best way.
DHTML includes JavaScript to make the page dynamic and regardless of which scripts is written for and the scripts are designed in such a way that it can be compatible with as many numbers of browsers as possible. The most important thing that must be kept in the mind is that we must test the code before running it over the server or making it live. Also we certainly cannot guarantee that all users will use the browser that will support the scripts.
Q: – 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 "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.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>
Q: – Write a DHTML page with a input box where background changes when the mouse is over the specified input box.
<html><head><script>
{document.getElementById(‘box’).style.background=color;
}</script>
</head>
<body>
<input value=”Mouse Over changes colors” size=”30″ onmouseover=”backgroundColor(‘green’)”>
</body>
</html>
Submitted By:– Rajesh Kumar Email-ID: – rajeshranga84@yahoo.com