alert('Oh shit !!!! Javascript is disabled!!!! ');


Blog Archive

DHTML Interview Question


DHTML Interview Questions And Answers


1. Ques: 1 What is the features of DHTML?
Some most important features of DHTML are given below:
1.Using DHTML we can change the tags and their properties.
2.It is use for Real-time positioning.
3.It is used to generate dynamic fonts (Netscape Communicator).
4.Used for Data binding (Internet Explorer).
2. Ques: 2 How FontSize and Font Size is differ in DHTML?
font size is an attribute that we used in font tag.Where as font-size is an style property. <font size="5"> use in font tag. p{font-size:"5"} use in CSS.
3. Ques: 3What is the difference b/w DHTML and HTML?
Some main difference b/w DHTML(Dynamic HTML) and HTML(Hyper Text Markup Language)are given below.
1.Using DHTML we can use JavaScript and style sheets in our HTML page.
2.Using DHTML we can insert small animations and dynamic menus into our HTML page.
3.If use want that your web page display your DHTML effects(object or word can highlighted, larger,a different color etc) than you have to save your web page with .dhtml extension except .html or .htm .
4. Ques: 4 How to Handle Events with DHTML?
Event is use to trigger actions in the browser. When client click on the element, associated action will started.Like: an JavaScript will started when client click on element.
Using Event Handler we can do like that,When an event occur it will execute code associated with that element.
Example:
In this example header will changes when client clicks.
<h1 onclick="this.innerHTML='abc!'">Click on this text</h1>
We can add a script in the head section and then we call the function from the event handler.
Example:
<html>
<head>
<script type="text/javascript">
function changetext(id)
{
id.innerHTML="abc!";
}
</script>
</head>
<body>
<h1 onclick="changetext(this)">Click on this text</h1>
</body>
</html>
5. Ques: 5 How to change HTML Attribute using HTML DOM?
I have given you example to change HTML Attribute by using HTML DOM. Example:
<html>
<body>
<img id="image" src="oldimage.gif">
<script type="text/javascript">
document.getElementById("image").src="newimage.jpg";
</script>
</body>
</html>
In the above example we load an image on HTML document by using id="image".Using DOM we get the element with id="image".JavaScript that we used in example to changes the src attribute from oldimage.gif to newimage.jpg
6. Ques: 6 How to change an HTML element using HTML DOM?
Here,I have given you example to change an HTML element using HTML DOM.
<html>
<body>
<h1 id=\"header\">
This is your Old Header</h1><script type=\"text/javascript\">document.
getElementById(\"header\")
.innerHTML=\"This is your New Header\";</script></body></html>Output:This is your New Header
In the above example it will store header with an id="header". And get the element with id="header" by using DOM.We used JavaScript to change the content of HTML.
7. Ques: 7 How you define HTML DOM?
HTML DOM is an Document Object Model for HTML. HTML DOM is an standard set of objects and way to access and manipulate HTML document.Using HTML DOM we can view whole HTML document as tree structure.Using this DOM tree we can access and manipulate all elements with their text and attributes. Some important points about HTML DOM are given below:
1.It is an standard object model and standard programming interface for HTML.
2.HTML DOM is an plateform and language dependant.
3.It is an W3C standard to get,change,add or delete HTML element.
8. Ques: 8 How we used JavaScript with CSS?
Using CSS with JavaScript we can change the style of HTML elements.Like that, document.getElementById(id).style.property=new style
9. Ques: 9 How to use JavaScript with HTML event?
In HTML4, we use HTML event to trigger the events than they perform their action.We can do like that when we click on event it will JavaScript. Example:
onclick=JavaScript
10. Ques: 10 How we used JavaScript with HTML DOM?
In HTML4, We use them to dynamically change the inner content and attributes of HTML elements.
I have you example which shows you how to change the content of HTML element. document.getElementById(id).innerHTML=new HTML We can change the attribute of an HTML element like that, document.getElementById(id).attribute=new value