Professional Documents
Culture Documents
Home Work-3: CAP305: Web Programming
Home Work-3: CAP305: Web Programming
I declare that this assignment is my individual work. I have not copied from any other
student’s work or from any other source except where due acknowledgment is made
explicitly in the text, nor has any part been written for me by another person.
Student’s Signature
Evaluator’s comments:
_____________________________________________________________________
ANSWER:
<html>
<body>
<h4>Cell backgrounds:</h4>
<table border="4">
<tr>
<td bgcolor="red">First</td>
<td>Row</td>
</tr>
<tr>
Second</td>
<td>Row</td>
</tr>
</table>
</body>
</html>
Q2. Using appropriate example enlist two types of table rows along with their attributes.
ANSWER:
TR:-The <tr> tag defines a row in an HTML table. A tr element contains one or more th or td
elements.
ALIGN Aligns row contents to the LEFT, RIGHT, or CENTER. (default LEFT)
VALIGN Aligns row contents to the TOP, MIDDLE, or BOTTOM. ( default MIDDLE)
dir rtl
Example :-
<html>
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
</html>
TH: -
The <th> tag defines a header cell in an HTML table. An HTML table has two kinds of cells:
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
ANSWER:
The HTML <table> tag is used for defining a table. The table tag contains other tags that define
the structure of the table.
By default, table cells tend to be squeezed close to each other. To give your table cells a little
more breathing room, use CELLPADDING and CELLSPACING.CELLSPACING controls the
space between table cells.
CELLPADDING sets the amount of space between the contents of the cell and the cell wall.
ALIGN: - ALIGN will place the table to the left, right or center of the width of the screen.
Width: - WIDTH specifies how far across the TABLE is going to be. The number for this
property can be specified as a number (in pixels) or a percentage of the screen width. If the
WIDTH property is not specified, the TABLE automatically adjusts itself to be as long as the
information contained within it.
Border: - BORDER specifies a pixel wide border around the TABLE. This creates a similar
effect as a frame around a picture. If this property is not specified, the default is 0.
Vspace: - Holds a number of pixels space above and below an aligned table (same as vspace in
the <img> tag).
Hspace: - Holds a number of pixels space to the left and right of an aligned table (same as
hspace in the <img> tag).
ALIGN Aligns row contents to the LEFT, RIGHT, or CENTER. (default LEFT)
VALIGN Aligns row contents to the TOP, MIDDLE, or BOTTOM. ( default MIDDLE)
ALIGN Aligns row contents to the LEFT, RIGHT, or CENTER. (default LEFT)
WIDTH Assigns a pixel or percentage width to the cell. (default cell content
width)
HEIGHT Assigns a pixel or percentage height to the cell. (default cell content
height)
Example :-
<html>
<CENTER>
CELLSPACING="1">
<TR>
<TD WIDTH="150"
</TD>
</TR>
</TR>
</TABLE>
</CENTER>
</html>
Part-B
Q4. Explain the function of bgcolor, bgcolor hexadecimal codes and caption tag with the
help of example.
ANSWER:
If you want to use a background color on your page, you will need to begin by finding the
<body> tag. Once you have found the tag, look for a command after the word body that says
bgcolor="color". It may look like this:
<body bgcolor="gray">
Or the tag may have more commands inside and use hex codes, like this:
And of course, the command may not be there at all. If this is the case, add it by placing a space
after the word body and then type the command, like this:
Or if you don't have any other commands, just add it in like this:
<body bgcolor="gray">
To change the background color, replace the word gray inside the quote marks with a color name
or a color hex code. For a list of some common color names and hex codes.
So, if you wanted to change the background color to green, you would type:
<body bgcolor="green">
If you use the hex code of a color, you place the entire hex code between the quote marks,
including the # sign. All the "0" characters are zeros. So, to use a hex code to change the
background color to blue, you would place the hex code for blue in the command, like this:
<body bgcolor="#0000FF">
Black #000000
White #ffffff
Red #ff0000
Blue #0000ff
Green #008000
Yellow #ffff00
Orange #ffa500
The <caption> tag must be inserted immediately after the <table> tag. You can specify only one
caption per table. Usually the caption will be centered below the table.
Example:
<table border="1">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Courses Courses
Schools
Dept
Blocks
ANSWER:
<html>
<frameset rows="20%,80%">
<frameset cols="20%,80%">
</frameset>
</frameset>
</html>
<html>
<body>
<center>
<h1>
</body>
</html>
<html>
<body>
<ul>
<li>Schools
<li>Dept
<li>Blocks
</ul>
</body>
</html>
Code for 4.html:-
<html>
<body>
class 1<br>
class 1<br>
class 1<br>
class 1<br>
class 1<br>
class 1<br>
class 1<br>
</body>
</html>
<html>
<body>
</body>
</html>
ANSWER:
JavaScript makes the web a much easier, faster and prettier place. JavaScript can also make the
web a most frustrating and insecure experience. An evolving case study transforms a static Web
site into a dynamic site using JavaScript. Exercises include:
•Implementing an interactive user interface using alert, confirm and prompt dialog boxes
•Incorporating DHTML effects into your Web pages
•Easy to learn
• Easy to implement
• Immediate results
• Very versatile
• Performance