Unit 3
Unit 3
What is Markup?
XML is a markup language that defines set of rules for encoding documents in a
format that is both hu
XML Text
The names of XML-elements and XML-attributes are case-sensitive, which
means the name of start and end elements need to be written in the same case.
To avoid character encoding problems, all XML files should be saved as Unicode
UTF-8
We can broadly categorize XML tags as follows −
Start Tag
The beginning of every non-empty XML element is marked by a start-tag.
Following is an example of start-tag −
<address>
End Tag
Every element that has a start tag should end with an end-tag. Following is an
example of end-tag −
</address>
Note, that the end tags include a solidus ("/") before the name of an element.
Empty Tag
The text that appears between start-tag and end-tag is called content. An
element which has no content is termed as empty. An empty element can be
represented in two ways as follows −
A start-tag immediately followed by an end-tag as shown below −
<hr></hr>
A complete empty-element tag is as shown below −
<hr />
Empty-element tags may be used for any element which has no content.
Rule 2
XML tags must be closed in an appropriate order, i.e., an XML tag opened inside
another element must be closed before the outer element is closed. For
example −
<outer_element>
<internal_element>
This tag is closed before the outer_element
</internal_element>
</outer_element>
DHTML
o HTML 4.0
o CSS
o JavaScript
o DOM.
HTML
HTML is a client-side markup language, which is a core component of the
DHTML. It defines the structure of a web page with various defined basic
elements or tags.
CSS
CSS stands for Cascading Style Sheet, which allows the web users or
developers for controlling the style and layout of the HTML elements on the
web pages.
JavaScript
JavaScript is a scripting language which is done on a client-side. The various
browser supports JavaScript technology. DHTML uses the JavaScript
technology for accessing, controlling, and manipulating the HTML elements.
The statements in JavaScript are the commands which tell the browser for
performing an action.
DOM
DOM is the document object model. It is a w3c standard, which is a standard
interface of programming for HTML. It is mainly used for defining the objects
and properties of all elements in HTML.
Uses of DHTML
Following are the uses of DHTML (Dynamic HTML):
o It is used for designing the animated and interactive web pages that
are developed in real-time.
o It also allows the page authors for including the drop-down menus or
rollover buttons.
DHTML JavaScript
JavaScript can be included in HTML pages, which creates the content of the
page as dynamic. We can easily type the JavaScript code within the <head>
or <body> tag of a HTML page. If we want to add the external source file of
JavaScript, we can easily add using the <src> attribute.
Following are the various examples, which describes how to use the
JavaScript technology with the DHTML:
Document.write() Method
The document.write() method of JavaScript, writes the output to a web page.
Example 1: The following example simply uses
the document.write() method of JavaScript in the DHTML. In this example,
we type the JavaScript code in the <body> tag.
1. <HTML>
2. <head>
3. <title>
4. Method of a JavaScript
5. </title>
6. </head>
7. <body>
8. <script type="text/javascript">
9. document.write("JavaTpoint");
10. </script>
11. </body>
12. </html>
1. <html>
2. <head>
3. <title>
5. </title>
6. <script type="text/javascript">
7. function dateandtime()
8. {
9. alert(Date());
10. }
11. </script>
12. </head>
16. Click here # <a href="#" onClick="dateandtime();"> Date and Time </a>
19. </font>
20. </body>
21. </html>
DHTML CSS
We can easily use the CSS with the DHTML page with the help of JavaScript
and HTML DOM. With the help of this.style.property=new
style statement, we can change the style of the currently used HTML
element. Or, we can also update the style of any particular HTML element
by document.getElementById(id).style.property =
new_style statement.
Example 1: The following example uses the DHTML CSS for changing the
style of current element:
1. <html>
2. <head>
3. <title>
5. </title>
6. </head>
7. <body>
8. <center>
10.
12. </html>
CSS
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p{
font-family: verdana;
font-size: 20px;
Applying Grouping Selectors in CSS
We have applied grouping selector using element name and using id of the
element.
We have used div and article element as grouping selector to
apply background-color, color and text-align properties to div and article
tag making it center aligned with green background and white text-color.
We have also used id1 and id2 id selectors as group selectors to
apply padding and border to h4 and span element.