Div Tag
The div tag defines a division or section in a document. It makes a logical division in a document. The function of the div tag does is that it leaves a white space before and after the div tag. In this way logical divisions can be made.
Example: |
|
<div style=”color:#FF0000;”> |
<h3> This is a header in this div section </h3> |
</div> |
|
<div style=”color:#CCCC99;”> |
<p> This is a paragraph in another div section </p> |
</div> |
| |
Span Tag
The span tag groups inline elements and formats them with styles in a document.
For example, if some lines in a paragraph have to be formatted differently than the rest of the lines, then, the span tag is used. Those lines whose format is to be changed are put between the span tags and the span tags are contained in the paragraph tags. The span tag can be used between any set of tags.
Example: |
|
<p> This is the first line in a paragraph. |
<span style=”color:#FFCC99;”> This is the second line in the paragraph. </span> |
This is third line in the paragraph. </p> |
| |
Introduction to JAVASCRIPT
Today's web sites are very interactive. Web Browsers allow users to interact with such web sites. HTML in itself allows minimal interaction with users. Truly interactive pages cannot be created using standard HTML 'tags' alone. Embedding JavaScript in an HTML document makes this possible.
JavaScript is an easy-to-use scripting language that can work with HTML. These scripts make the web site dynamic in nature. The web pages created by using JavaScript can accept input from the user, show pop-up windows, create cookies etc.
In the example stated below, an alert box will pop up when the web page is loaded. In this, a simple function called message is created, and this function is triggered with the onload event (More can be read about JavaScript in the JavaScript tutorial).
Example: |
|
<html> |
<head> |
<script type="text/javascript"> |
Function message() |
{ |
Alert("This alert box will be called when the page is loaded") |
} |
</script> |
</head> |
|
<body onload="message()"> |
|
</body> |
</html> |
| Output: |
| |
 |
| |
Script Tag
The script tag is used to define a script, such as JavaScript. This tag is used in the example shown above. In this, the type of the script has to be given with it.
In the following example, “How are you?” will be printed in the browser but with the use of JavaScript.
Example: |
|
<script type=”javascript”> |
Document.write(“How are you?”) |
</script> |
| |
Noscript Tag
The noscript tag is used to display some alternate content if the browser does not execute the script. This tag is used for the browsers who do not support scripting.
Example: |
|
<script type=”javascript”> |
Document.write(“How are you?”) |
</script> |
|
<noscript> Your browser does not support scripting. </noscript> |
| |
Applet Tag
The applet tag defines an embedded applet. An applet is a small application program. This tag is used to include applets in a web page. Applets are not written in HTML. They are separate programs written in Java language.
Attributes of Applets
Code
Code gives the file name of the applet to run.
Example: |
|
<applet code= “myapplet.class” > |
</applet> |
| |
Codebase
Codebase indicates the path to the directory of applet class. It indicates how to find the class file when it is not in the same directory as the web page.
Example: |
|
<applet code=”myapplet.class” codebase=”../applets” > |
</applets> |
| |
Width
Width indicates how wide the applet should be.
Example: |
|
<applet code=”myapplet.class” codebase=”../applets” width=100> |
</applet> |
| |
Height
Height indicates how tall the applet should be.
Example: |
|
<applet code=”myapplet.class” codebase=”../applets” width=100 height=50> |
</applet> |
| |
|