Nice book written by David R. Brooks. I strongly believe this book is for programmers who are new to HTML and web programming.
I wanted to share few points from this book.
1) HTML is an acronym for HyperText Markup Language. HTML documents,the foundation of all content appearing on the World Wide Web (WWW), consist of two essential parts: information content and a set of instructions that tells a computer how to display that content.
2) JavaScript is an interpreted (rather than a compiled) object-oriented programming language, with roots in C/C++, that has been developed for use with other Web tools. It does not operate as a standalone language,but rather is designed to work together with HTML for creating interactive Web pages. JavaScript is not the same as Java, which is a compiled object-oriented language.
3) How do you display double quote marks with the document.write() method if you cannot use double quotes inside a quoted string? One way is to use the escape sequence ". Escape sequences always start with an ampersand (&) and end with a semicolon (;)
4) Description of attributes:
These descriptions may not include all possible values.
a) align = "…"
Values: "left", "right", or "center"
Aligns text horizontally.
b) background = "…"
Value: the URL of a gif- or jpeg-format graphics file Setting the background attribute displays the specified image as the background behind a displayed HTML document page. Depending on the image size (in pixels), background images may automatically be “tiled,” resulting in a repeating image that can be visually distracting. It is not necessary to use background images, and they should be used with care.
c) bgcolor = "…"
Values: Background colors can be set either by name or by specifying the intensity of the red, green, and blue colors.
d) border="…"
Value: The width, in pixels, of a border surrounding an image
e) color = "…"
Values: Text colors can be set either by name or by directly specifying the intensity of the red, green, and blue colors
f) face = "…"
Values: Font typefaces can be set either generically, with cursive,monospace, sans-serif, or serif, or with specific font names supported by the user’s computer.
The generic names should always produce something that looks reasonable on any computer, but specific font names that are not available on the user’s computer may produce unexpected results.
g) height = "…"
Value: The height, in pixels, of an image.
h) href = "…"
Value: The URL of an external or internal Web resource or the name of an internal document reference.
i) hspace = "…"
Value: The horizontal space, in pixels, between an image and the surrounding text.
Please read this good article about vspace and hspace.
j) name = "…"
Value: The name assigned to an internal document reference through an “a” element.
k) size = "…"
Values: An unsigned integer from 1 to 7 or a signed number from +1 to +6 or –1 to –6.
An unsigned integer is an absolute font size, which may be system-dependent. The default value is 3. A signed integer is a font size relative to the current font size, larger for positive values and smaller for negative values.
For the hr element, size is the vertical height of the horizontal rule, in pixels.
l) src = "…"
Value: The URL of a graphics file. For local use, images and their HTML document are usually stored in the same folder.
m) text = "…"
Values: The text attribute, used with the body element, selects the color of text in a document, which prevails unless overridden by a font attribute.
o) vspace = "…"
Value: The vertical space, in pixels, between an image and the surrounding text.
p) width = "…"
Values: The width of an image or horizontal rule, in pixels or as a percent of total screen width. For example, width="80" is interpreted as a width of 80 pixels, but width="80%" is a width equal to 80 percent of the total screen width.
5) Show how to use a style sheet file to specify different background and text colors for different sections of text.
Example
rwb.html
<html>
<head>
<title>A Red, White, and Blue Document</title>
<link href="rwb.css" rel="stylesheet" type="text/css" />
</head>
<body>
<img src="stars.jpg" height="150" width="250" />
<p class="red">
This text should be blue on a red background.
</p><p><div class="white" style="font-style: italic;">
This text should be red on a white background.
</div></p>
<p><span class="blue">This text should be white on a blue background.</span>
</p>
</body>
</html>
rwb.css
p.red {background:red;color:blue;font:20pt Times}
div.white {background:white;color:red;font:20pt Times}
span.blue {background:blue;color:white;font:20pt Times}
6) Diff between push and shift operation in javascript arrays.
The shift function can be used to remove the first element of an array. It also returns the first element.
The pop function can be used to retrieve the last element of an array.
This article gives more information about all javascript array functions.
Below example will try to describe the difference
<html>
<head>
<title>Stacks and Queues</title>
<script language="javascript" type="text/javascript">
var a=[1,3,5,7], i;
// Treat the array like a stack.
document.write("STACK:" + a + " length of a = " + a.length+"<br />");
a.push(11,12,13);
document.write(a + " length of a = " + a.length
+"<br />");
for (i=1; i<=3; i++) {
a.pop();
document.write(a + " length of a = " +
a.length+"<br />");
}
// Treat the array like a queue.
document.write("QUEUE:" + a + " length of a = " + a.length+"<br />");
a.push(11,12,13);
document.write(a + " length of a = " + a.length
+"<br />");
for (i=1; i<=3; i++) {
a.shift();
document.write(a + " length of a = " + a.length
+"<br />");
}
</script>
</head>
<body></body>
</html>
prints
STACK:1,3,5,7 length of a = 4
1,3,5,7,11,12,13 length of a = 7
1,3,5,7,11,12 length of a = 6
1,3,5,7,11 length of a = 5
1,3,5,7 length of a = 4
QUEUE:1,3,5,7 length of a = 4
1,3,5,7,11,12,13 length of a = 7
3,5,7,11,12,13 length of a = 6
5,7,11,12,13 length of a = 5
7,11,12,13 length of a = 4
Hope you enjoy reading the book.
No comments:
Post a Comment