Mar 2023 - 6th 7th 8th 9th 10th Standard Print
Mar 2023 - 6th 7th 8th 9th 10th Standard Print
Inside this chapter : Header and footer, Formatting of paragraph, Mail merge, Envelop and labels, Page
column, Hyperlink, Drop cap.
Microsoft word or MS-Word (often called word) is a graphical word processing program
by Microsoft Corporation. The purpose of the MS Word is to allow the users to type and save
documents. Similar to other word processors, it has various helpful tools to make documents.
18
You will see the application window of MS Word as below
After starting MS Word, you will see the menu bar items as below
19
2. Find Header and Footer
The Design tab will appear on the Ribbon, and the header or footer will appear in the
document.
Here you can place Date & Time, Page number, Picture Clip Art and other desired
information.
When you have finished editing, click Close Header and Footer in the
Design tab, or hit the Esc key.
After you close the header or footer, it will still be visible, but it will be locked. To edit it again,
just double-click anywhere on the header or footer margin and it will become unlocked for
editing.
20
Paragraph
MS Word includes many features designed to assist you in placing text on the page just
the way you want it. You can align text left to right using tabs or alignment options, or you can
adjust your text vertically using line spacing options. Following are some of the available
paragraph formatting choices.
Aligning Text:
Alignment arranges the text to line up at one or both margins, or in center between the
margins. Alignment applies to entire paragraphs. You can align text to the left, right, or center,
or you can justify your text, which means that the text becomes evenly spaced across the page
from the left margin to the right margin. Apply alignment options by selecting the text you
want to align, then choosing Home > Paragraph and clicking one of the following alignment
buttons:
• Align Text Left: The text aligns evenly at the left margin. This is the default choice.
• Center: The text centers evenly between the left and right margins.
• Align Text Right: The text aligns along the right document margin.
• Justify: The text fills with micro spaces so it aligns evenly on both the left and right
margins.
Following picture illustrates a document with text matching each alignment option.
21
Adding Paragraph Borders
Word includes borders that you can apply to any size block of text, which draw the
reader’s eye to specific areas for a “quick read.”
A border can cover the entire area or be any combination of lines around the text, such
as above and/or below the text. Select the text you want bordered and choose Home >
Paragraph.
Click the drop-down arrow next to the Borders button, which displays a list of options
like the one you see in following picture. Choose the border option you want.
Shading Text
Shading helps you distinguish headlines and important passages, such as sidebars, by
creating a screen, which is typically light gray shading against the standard black text.
Click anywhere in the paragraph you want shaded and choose Home > Paragraph >
Shading. Choose a color from the resulting Shading gallery, as shown in following picture.
Adding dark blue shading caused Word to change the font color to white.
22
If you want to add a shading pattern ranging from a light 5%
shade to patterns, such as diagonal stripes or polka dots, you can
choose Home > Paragraph, and then click the Borders drop-down
arrow. From the list, select Borders and Shading, which then displays
the Borders and
Shading dialog box.
23
Indenting Text
Typically, text runs between the left and right margins, but you may want to indent
particular paragraphs. Click anywhere in the paragraph you want to indent, and then choose
Home > Paragraph > Increase Indent. Each click of the Increase Indent button indents the text
one-half inch from the left margin. Click the Decrease Indent button to move the text back one-
half inch.
If you want to indent from the right margin or you want to manually set how much
indentation Word applies, you can use the Format Paragraph dialog box. Click the Paragraph
Dialog Box Launcher, which displays the Paragraph dialog box shown in following picture.
Click the spinner arrows for the Left or the Right text boxes to specify the number of
inches to indent the left and right edge of the paragraph. The Preview box at the bottom
shows the effects of your settings. Optionally, click the Special dropdown list and select an
indenting option:
• First line: This option indents only the first line of the paragraph and leaves the rest of
the paragraph even with the left margin.
• Hanging: This option indents all lines except the first line of the paragraph.
Click OK after you finish making selections. Word applies the paragraph indentation settings
you selected.
Another way to control indention is by dragging the indentation icons on the ruler:
If you don’t see the ruler, choose View > Show > Ruler.
Left Indent Hanging Indent First Line Indent Right Indent
24
Mail Merge
Mail merge is a very important tool which allows you to create form letters, mailing
labels, and envelopes by linking a main document to a set of data or data source. The main
document is linked to the data source by common fields of data, called merge fields.
For example, in a form letter, your main document would be the letter informing the
parents to be called for a parent teacher meeting. The data source is where the fields of
information on each parent receiving the letter are located. The data source would contain
names, addresses, phone number etc.
If you were printing envelopes or address labels, the main document would be the
envelopes or the sheet with labels on it; the data source would be the addresses that are to be
placed on these envelopes or labels of sheets.
When you are performing a Mail Merge, you will need a Word document (you can start
with an existing one or create a new one) and a recipient list, which is typically an Excel
workbook.
Exploring Mail Merge practically:
1. Open an existing Word document, or create a new
one.
2. Click the Mailings tab.
3. Click the Start Mail Merge command.
4. Select Step by Step Mail Merge Wizard.
The Mail Merge task pane appears and will guide you through the six main steps to
complete a merge. The following is an example of how to create a form letter and merge the
letter with a recipient list.
Step 1:
1. Choose the type of document you want to create. In this
example, select Letters.
2. Click Next: Starting document to move to Step 2.
Step 2:
1. Select Use the current document.
2. Click Next: Select recipients to move to Step 3.
25
Step 3:
Now you'll need an address list so Word can automatically place each address into the
document. The list can be in an existing file, such as an Excel workbook, or you can type a new
address list from within the Mail Merge
Wizard.
1. From the Mail Merge task pane,
select Use an existing list, and then
click Browse.
2. Locate your file in the dialog box
(you may have to navigate to a
different folder), then click Open.
3. If the address list is in an Excel
5. From the Mail Merge task pane, click Next: Write your letter to move to Step 4.
Step 4:
Now you are ready to write your letter. When it's printed, each copy of the letter will basically
be the same, except the recipient data like the name and address will be different on each one.
26
You'll need to add placeholders for the recipient data so Mail Merge knows exactly where to
add the data. If you're using Mail Merge with an existing letter, make sure the file is open.
27
2. Click Next: Complete the merge to move to Step 6.
Step 6:
1. Click Print to print the letters.
2. The Merge to Printer dialog box opens. Click All, then click OK.
3. The Print dialog box will appear. Adjust the print settings if
needed, then click OK.
28
Envelops and Labels
There are times when you may need to print several envelopes that have the same
delivery address, or you may need to keep an envelope on file for future use. The developers
at Word provided the capability to add an envelope to your current document, but not to
create a new document that contains just an envelope.
Let’s see how to create and use envelopes and labels
1. Open an existing document that contains
the address you want to use on your
envelope.
2. Highlight the address and copy it to the
Clipboard by pressing Ctrl+C.
3. Create a new document.
4. Display the Mailings tab of the ribbon.
5. Click Envelopes in the Create group.
Word displays the Envelopes and Labels
dialog box.
6. Make sure the Envelopes tab is selected.
7. Place the insertion point in the Delivery Address area.
8. Press Ctrl+V to paste the address you copied in step 2.
9. Using the Options button you can change the orientation and formatting.
10. Click on the Add to Document button. Your envelope is ready
29
Labels
As I mentioned in the Envelopes section, the envelopes and labels feature can be found
in the same place: the Mailings tab.
30
Your labels with same address are ready and it can be saved & printed.
31
Now, Type “To” in the Label and click on Mailing tab -> Insert Merge Fields->Title.
Repeat this step to insert other Fields, like
First_Name, Last_Name. Now copy these
Inserted fields to other label (after <<Next
Record>>)
Finally, your window should be as below
Your labels with different addresses are ready, save this document.
32
Page Column
Columns are used in many types of documents, but they are most commonly used in
newspapers, magazines, academic journals, and newsletters. Columns are also used in your
NCRT Textbooks. In this lesson, you will learn how to insert columns into a document and
create column breaks.
Inserting Columns
Columns and column breaks can improve your document's organization and increase its
readability. They also allow you to utilize all of the available space on the page.
How to add columns?
1. Select the text you want to format.
2. Click the Page Layout menu tab.
3. Click the Columns command. A drop-down menu will appear (as shown below).
33
If you want to remove the columns, click the Columns command and
select One for the number of columns.
Hyperlink
A hyperlink is a word, phrase, or image that you can click on to
jump to a new document or a new section within the current
document. Hyperlinks are found in nearly all Web pages, allowing
users to click their way from page to page. Hypertext is text with
hyperlinks.
There are two ways that you can insert a hyperlink in Word 2010.
Using the first method, you type out the text for the link then select it and click the
Insert tab, then click the Hyperlink command in the Links group.
In the Insert Hyperlink window that opens, you can type in the website URL
into the address box if the link is to a website. (as shown below)
after pressing OK button you will see the text appers blue and underlined. Your
hyperlink is ready. Click on the link see the result.-----------
However, you could also link to the following:
• An existing file on your computer
• A location in the current document
• A new document
• An email address
Each of the above options can be used by clicking on its
corresponding button on the left of the Insert Hyperlink
window.
34
Drop Cap
A drop cap is a large capital letter at the beginning of a text block that has the depth of
two or more lines of regular text.
Let’s see how you can do it. Open a document Word document and select the letter
you want to insert as drop cap. Click on the "Insert"
tab, and in the "Text" group you can find "Drop Cap"
button. Click it, and hold the mouse pointer over your
choice to see a preview in your document.
The steps to decide the size and modify the drop cap are the same as the steps.
35
WORKSHEET
36
This way you can create a Marksheet with ease.
D
I D E T
O C H
D
E V L P
A L M R E
P R
B N
I
L
K
37
Chapter 3
Inside this chapter : Table creating in MS Excel and implementation various Charts, Cell reference in MS
Excel, Sorting of data in MS Excel, Filtering data in MS Excel, Conditional Formatting, Workbook and
worksheet, Protection of workbook and worksheet.
Microsoft Excel is a powerful spread sheet application that is perfect for maintaining
long lists of data, budgets, sales figures and other data. In this chapter you will learn some
important and interesting features of Excel like Table, Cell reference, inbuilt functions, sorting
of data etc. Let’s discuss these features one by one.
Creating a bar or column chart
To learn how to create a Column and Bar chart in Excel, let's use a simple example of
marks secured by some students in Science and Maths that we want to show in a chart format.
Note that a column chart is one that presents your data in vertical columns. A bar chart is very
similar in terms of the options you have, but presents your data in horizontal bars. The steps
below take you through creating a column chart but you can also follow them if you need to
create a bar chart.
Preparing chart data
The table below shows the data we want to chart. It is important that your data be
presented correctly in order to create a good looking chart.
38
→ In our example above, that means selecting the range of cells from B5:D13.
→ It's important to remember to include the row headings if you want to use those
values as axis labels on your finished chart.
• Next, click Insert in the menu. The ribbon will change, and will include a number of
chart options(as shown below)
Now again select the data (cells from B5:D13) and this time select 3D Clustered Column
Chart in Bar chart option and your Bar chart will be ready.
39
• Note the following points about this chart:
→ Excel has automatically put labels on an angle to fit neatly into the space
available.
→ The legend to the right of the chart contains the column heading from our
spreadsheet. You can change them by editing the headings in our data table.
→ Excel has chosen these colours based on a default theme. You can change the
theme if you need to, and the colours will change automatically. You can also
override the colours manually if you need to.
→ There is no title on the chart by default. You can add one manually, or choose a
chart layout that includes one.
40
7. Press Ctrl+V or click the Paste button on the Home tab.
8. If you see a moving marquee around cell C2, press the Esc key.
Cell C3 should be the active cell, but if it is not, just click it once on C3. Look at the
Formula bar. The contents of cell C3 are =B3*2, and not the =B2*2 that you copied.
What happened? Excel assumed that if a formula in cell C2 references the cell B2 one
cell to the left then the same formula put into cell C3 is supposed to reference cell B3 also one
cell to the left. Relative references adjust when you copy a formula.
By default, Excel uses relative reference. Let’s see another example. See the formula in cell
D2 below. Cell D2 references (points to) cell B2 and cell C2. Both references are relative.
1. Select cell D2, click on the lower right corner of cell D2 and drag it down to cell D5.
Cell D3 references cell B3 and cell C3. Cell D4 references cell B4 and cell C4. Cell D5
references cell B5 and cell C5. In other words: each cell references its two neighbours on the
left.
Absolute cell reference: Sometimes you don't want relative addressing but rather absolute
addressing: making a cell reference fixed to an absolute cell address so that it doesn't change
41
when the formula is copied. In an absolute cell reference, a dollar sign ($) precedes both the
column letter and the row number. See the following example
1. To create an absolute reference to cell H3, place a $ symbol in front of the column letter
and row number of cell H3 ($H$3) in the formula of cell E3.
The reference to cell H3 is fixed (when we drag the formula down and across). As a result, the
correct lengths and widths in inches are calculated.
Mixed reference: You can also have a mixed reference in which the column is absolute and
the row is relative or vice versa. To create a mixed reference, you use the dollar sign in front of
just the column letter or row number. Here are some examples:
Cell Reference Types
Reference Type Formula After copying the Formula
Relative =A1 Both the column letter A and the row number 1 can change.
Absolute =$A$1 The column letter A and the row number 1 does not change.
Mixed =$A1 The column letter A does not change. The row number 1 can change.
Mixed =A$1 The column letter A can change. The row number 1 does not change.
42
Built in functions
MS Excel has many built in functions which we can use in our formula. To see all the
functions by category choose Formulas Tab » Insert Function. Then Insert function Dialog
appears from which we can choose function.
43
o NOT : Returns a logical value that is the opposite of a user supplied logical value
or expression i.e. returns FALSE is the supplied argument is TRUE and returns
TRUE if the supplied argument is FALSE)
• Mathematical
o SQRT : Returns the positive square root of a given number
o POWER: Returns the power of a number raised to second number.
How to insert a function in excel
Every function has the same structure. For example, SUM(A1:A4). The name of this
function is SUM. The part between the brackets (arguments) means we give Excel the range
A1:A4 as input. This function adds the values in cells A1, A2, A3 and A4. It's not easy to
remember which function and which arguments to use for each task. Fortunately, the Insert
Function feature in Excel helps you with this.
To insert a function, execute the following steps.
1. Select a cell.
2. Click the Insert Function button.
The 'Insert Function' dialog box appears.
3. Search for a function or select a function from a
category. For example, choose COUNTIF from the
Statistical category.
4. Click OK.
The 'Function Arguments' dialog box appears.
44
Sorting in Excel
Sorting is a common task that allows you to change or customize the order of your
spreadsheet data. For example, you could organize your class student’s birthday list will
make you easier to find what you are looking for. Custom sorting takes it a step further, giving
you the ability to sort multiple levels—such as Name first, then birthdate etc.
To sort in alphabetical order:
1. Select a cell in the column you want to sort by. In this
example, we'll sort by Name.
2. Select the Data tab, then locate the Sort and Filter
group.
3. Click the ascending command to Sort A to Z or the
descending command to Sort Z to A.
4. The data in the spreadsheet will be organized alphabetically. (as shown below)
45
Sorting options can also be found on the Home tab, condensed into the
Sort & Filter command.
To sort in numerical order:
1. Select a cell in the column you want to sort by.(In our example C6)
2. From the Data tab, click the ascending command to Sort Smallest to Largest or the
descending command to Sort Largest to Smallest.
3. The data in the spreadsheet will be organized numerically.
Filters in Excel
If your worksheet contains a lot of content, it can be difficult to find information
quickly. Filters can be used to narrow down the data in your worksheet, allowing you to view
only the information you need.
Filtering data: In the following example, I am applying a filter to an equipment log worksheet
to display only the laptops and projectors that are available for checkout.
1. In order for filtering to work correctly, your worksheet should include a header row,
which is used to identify the name of each column. In our example, our worksheet is
organized into different columns identified by the header cells in row 1: ID#, Type,
Equipment Detail, and so on.
46
2. Select the Data tab, and then click the Filter command.
3. A drop-down arrow will appear in the header cell for each column.
4. Click the drop-down arrow for the column you want to filter. In our example, we will
filter column B to view only certain types of equipment.
47
8. The data will be filtered, temporarily hiding any content that doesn't match the criteria.
In our example, only laptops and tablets are visible.
Filtering options can also be accessed from the Sort & Filter
command on the Home tab.
48
4. The new filter will be applied. In our example, the worksheet is now filtered to show
only laptops and tablets that were checked out in August.
49
Conditional formatting in Excel
Excel conditional formatting is a really powerful feature which helps you highlight the
most important information in your spreadsheets and identify variances of cells' values with a
quick glance. Conditional formatting in Excel is very straightforward and easy to use. So now
let’s discuss it with an example.
For a start, let's see where you can find the conditional formatting feature in MS Excel
2010. See Home tab -> Styles group.
Conditional formatting in Excel
50
5. Enter the value in box in the right-hand part of the window under "Format cells that are
LESS THAN", in our case we type 13.
As soon as you have entered the value, Microsoft Excel will highlight the cells in the
selected range that meet your condition.
Worksheet
A worksheet is a collection of cells where you keep and manipulate the data. By default,
each Excel workbook contains three worksheets. An Excel worksheet is a single spreadsheet
that contains cells organized by rows and columns. A worksheet begins with row number 1
and column A. In Excel 2010, the maximum size of a worksheet is 1,048,576 rows by 16,384
columns.
Select a Worksheet
When you open Excel, Excel automatically selects Sheet1 for you. The name of the
worksheet appears on its sheet tab at the bottom of the document window.
To select one of the other two worksheets, simply click on the sheet tab of Sheet2 or Sheet3.
Rename a Worksheet
By default, the worksheets are named Sheet1, Sheet2 and Sheet3. To give a worksheet a more
specific name, execute the following steps.
1. Right click on the sheet tab of Sheet1.
2. Choose Rename.
3. For example, type Class VI.
51
Insert a Worksheet
You can insert as many worksheets as you want. To quickly insert a new worksheet, click the
Insert Worksheet tab at the bottom of the document window.
Move a Worksheet
To move a worksheet, click on the sheet tab of
the worksheet you want to move and drag it
into the new position.
1. For example, click on the sheet tab of Sheet4
and drag it before Sheet2.
Delete a Worksheet
To delete a worksheet, right click on a sheet tab and choose Delete.
For example, delete Sheet4.
52
Copy a Worksheet
Imagine, you have Class VI ready and want to create the exact same sheet for Class VI
Games, but with different data. You can recreate the worksheet, but this is time-consuming. It's
a lot easier to copy the entire worksheet and only change the numbers.
1. Right click on the sheet tab of Class VI.
2. Choose Move or Copy...
The 'Move or Copy' dialog box appears.
4. Click OK.
53
Workbook
Excel 2010 includes a Protect Workbook command that prevents others from making
changes to the layout of the worksheets in a workbook. You can assign a password when you
protect an Excel workbook so that only those who know the password can unprotect the
workbook and change the structure or layout of the worksheets.
Now, let’s see protections one by one with example.
How to protect an excel workbook
This example teaches you how to protect the workbook structure and windows in Excel.
Protecting Structure
If you protect the workbook structure, users cannot insert, delete, rename, move, copy, hide or
unhide worksheets anymore.
1. Open a workbook.
2. On the Review tab, click Protect Workbook.
54
Protecting windows
If you protect the workbook windows, users cannot move, change the size and close windows
anymore.
1. Open a workbook.
2. On the Review tab, click Protect Workbook.
You cannot move, change the size and close windows anymore.
To unprotect the workbook, click Protect Workbook and enter the password.
55
Protect Sheet
Sometimes you may want to protect a worksheet to help prevent it from being changed.
Follow these steps to protect the worksheet.
1. Right click a worksheet tab.
2. Click Protect Sheet.
3. Enter a password.
4. Check the actions you allow the users of your
worksheet to perform.
5. Click OK.
6. Confirm the password and click OK.
56
WORKSHEET
Bar chart, Worksheet, $, Autosum, formula bar, Sorting, =, Logical operator, now, three
2. You have an Excel spreadsheet and you would like to filter more than types of criteria
from a single column. How can filter a single column based on one or more criteria?
3. You are trying to put some data in alphabetical order. There are 4 columns and over
2,000+ rows of information. I need to sort the data by column B in alphabetical order.
How do you do this?
57
Solve the crosswords using the words from the lesson
A S R T
S S R M X
T
F R M L
L G T A Y
E T C L
R
F
O W R
T
58
Chapter 4
Inside this chapter : Inserting different objects (i.e. images, Word Arts, audio & video etc.), Transitions in
slide, Custom Animation with text.
59
Using Insert picture tool
If you want to add a picture on an existing slide that has no Content placeholder, you can
select the Insert tab of the Ribbon, and click the Picture button.
Either way, you will open the Insert Picture dialog box. Navigate to the folder where your
pictures are located, you will see the icons or thumbnails of the pictures as shown in following
picture. Select the picture you need, and click on the Insert button highlighted in red.
As soon as you click the Insert button, you will see the selected picture placed on the
PowerPoint slide.
60
2. Inserting Word Art
WordArt offers additional effects like outline text, fill, gradient, 3D effects and shadows etc.
If you want to, you can add WordArt using the WordArt command on the Insert tab in the
Text group.
1. On the Insert tab, in the Text group, click WordArt. The WordArt Styles gallery opens.
2. Click on the style you want to insert, and a text box appears with the text “Your text
here”, with the WordArt style you selected applied to it.
61
This contains the Preset styles gallery, and drop downs for controlling the Text Fill, Text
Outline, and (most fun) Text Effects.
62
2. The most commonly used animations will appear in the center. To preview more
transition options, click the down arrow.
3. Select a transition from the list. Clicking it will apply the transition to the slide. You
can also select Apply to All to apply the same transition to all your slides.
4. In the Duration option, enter the speed at which you want the transition to play.
5. In the Sound field, use the drop-down menu to select a sound to play during a slide
transition, if desired.
6. Indicate how you want the slide transition to occur by selecting an option under the
Advance Slide heading. Select On mouse Click if you want the transition to take place
when you click the left mouse button.
Select Automatically After if you want the transition to occur after a specified time. Use
the up and down arrow keys in the blank box to specify the number of seconds which
should pass before the transition takes place.
63
Types of animations
There are many different animation effects you can choose from, and they are organized into
four types:
• Entrance: These control how the object enters the slide. For example, with the Bounce
animation, the object will drop onto the slide and then bounce several times.
• Emphasis: These animations occur while the object is on the slide and are often
triggered by a mouse click. For example, you can set an object to Spin when you click
the mouse.
• Exit: These control how the object exits the slide. For example, with the Fade animation,
the object will simply fade away.
• Motion Paths: These are similar to Emphasis effects, except the object moves within
the slide along a predetermined path, like a circle.
64
4. Select the desired animation effect.
5. The text will now have a small number next to it to show that it has an animation. Also,
in the Slide pane, the slide will now have a star symbol next to it.
Some effects will have options you can change. For example, with the Fly In effect, you can
control which direction the object comes from. These options can be accessed from the Effect
Options command in the Animation group.
You can apply more than one animation effects for a text
65
Animation Painter:
Sometimes you may want to apply the same effects to more than one object. You can do this
by copying the effects from one object to another using the Animation Painter.
1. Click the object that has the effects you want to copy.
2. From the Animations tab, click the Animation Painter command.
3. Click the object you want to copy the effects to. The effects will be applied to the object.
Animation pane
The Animation pane allows you to view and manage all of the effects that are on the current
slide. You can modify and reorder effects directly from the Animation pane, which is especially
useful when you have several effects.
To open the Animation pane:
1. From the Animations tab, click the Animation Pane command.
2. The Animation pane will open on the right side of the window. It will show all of the
effects for the current slide in the order they will appear.
66
To reorder effects from the Animation pane:
1. On the Animation pane, click and drag an effect up or down.
2. The effects for the current slide will play. On the right side of the Animation pane, you
will be able to see a timeline that shows the progress through each effect.
67
To open the Effect Options dialog box:
1. From the Animation pane, select an effect. A drop-down arrow will appear next to the
effect.
2. Click the drop-down arrow, and select Effect Options. The Effect Options dialog box will
appear.
3. From here, you can add various enhancements to the effect:
o Sound: This adds a sound effect to the animation.
o After animation: This changes the color after the animation is over.
o Animate text: If you are animating text, you can choose to animate it all at once,
one word at a time, or one letter at a time.
68
WORKSHEET
1…………….is the term used when you press and hold the left mouse key and move the
I A G
P W P I T
T R N S T O
U
O O N
W
69
Chapter 6
HTML
Inside this chapter : Introduction to HTML, Uses of HTML, HTML Tags, HEAD, TITLE, BODY, Empty and
Container Tags.
What is HTML?
HTML is a computer language invented to allow website creation. The websites can then be
viewed by anyone else connected to the Internet. It is relatively easy to learn, with the basics
being accessible to most people in one sitting and quite powerful in what it allows you to
create. HTML is used to build the websites or web based applications.
HTML stands for Hyper Text Markup Language.
• HyperText is the method by which you move around on the web by clicking on special
text called hyperlinks which bring you to the next page.
• Markup is what HTML tags do to the text inside them. They mark it as a certain type of
text for example italicized text.
How does it work?
HTML consists of a series of short codes typed into a text-file called as tags. The text is then
saved as html file, and viewed through a browser like Internet Explorer. This browser reads
the file and translates the text into a visible form, hopefully rendering the page as the author
had intended.
Some of the most popular HTML editors, such as FrontPage or Dreamweaver will let you
create pages more or less as you write documents in Word or whatever text editor you are
using.
Essential HTML Tags
There are four sets of HTML tags that form the basic structure needed for every HTML file:
• <html></html>
• <head></head>
• <title></title>
• <body></body>
77
<html> </html>
This basically defines the document as web page. It also identifies the beginning and
end of the HTML document. All other tags must fall between the html tags.
<head> </head>
The header contains information about the document that will not appear on the actual
page, such as the title of the document, the author etc.
<title> </title>
The title tag defines the title that will appear in the title bar of your web browser. The
title must appear between the head tags.
<body> </body>
The body tags contain all the information and other visible content on the page. All
your images, links and plain text must go between the <body> and </body> tags.
You may also be interested in the basic tags for adding content and headings.
Example:
Below is a basic html document. Notice that everything falls between the html tags, the title
appears within the head of the document, and that the body comes after the head.
1. Open Notepad.
2. Type the HTML program as given below.
3. Click file->Save as
78
Empty tag and Container tag
A container tag has two ends (an opening and a closing) whereas an empty tag doesn't.
The paragraph tag is an example of a container tag:
<p>Our paragraph text here.</p>
The image tag is a good example of an empty tag.
<img src="kvslogo.png" >
See how the initial paragraph tag (<p>) has a corresponding end tag? The text in between is
"contained" by the tag.
The majority of tags are "container" tags. They have an opening and a closing tag.
However, a few tags are "self-contained" or "empty" tags in that they have an opening tags but
not a closing one.
They common ones are:
• <br> = break
• <img> = image
• <meta> = metadata within an HTML document.
79
WORKSHEET
<BR>, <HTML>, header, .html, container, tag, title, body, empty , web programming
1. Create a HTML page that contains your name, class, father’s name, mother’s
name etc. Save this HTML file to Desktop and test the result.
H L
H
W E P G
D A R U
H E L K
80
Chapter 7
Inside this chapter : Overview of Internet, Intranet, Different types of websites, Web Browsers, Opening of
web pages and Web sites, Use of search engine, Creation of an Email and using it, Advantages and
Disadvantages of Social Media sites, Networking and Networks.
Advantages
Internet covers almost every aspect of life. Here, we will discuss some of the advantages of
Internet.
81
Internet allows you to communicate with the people sitting at remote locations using
we site and applications like Facebook,Twitter,Yahoo,Google+,Flickr,Orkut etc.
You can find any kind of information on any topic over the internet such as Technology,
Health & Science, Social Studies, Geographical Information, Information Technology,
Products etc.
It also provides entertainment through various modes like online television, online
games, songs, videos, social networking apps.
Internet also allows us to use many services like Internet banking, matrimonial services,
online shopping, online ticket booking, online bill payment, data sharing, e-mail etc.
Disadvantages
However, Internet has proved to be a powerful source of information in almost every field, yet
there exists many disadvantages discussed below:
82
There are always chances to loose personal information such as name, address, credit
card number. Therefore, one should be very careful while sharing such information.
Spamming corresponds to the unwanted e-mails in bulk. These e-mails serve no
purpose and lead to block of entire system.
Virus can easily be spread to the computers connected to internet.
There are many pornographic sites that can be found, which indirectly affects your
healthy and mental life.
83
Types of websites: There are various types of website available in Internet. Here we will
discuss some basic types.
Website Type Definition Example
Personal Used for sharing personal
http://www.sachintendulkar.in
Websites information.
Photo Sharing
Used for sharing photographs. https://www.flickr.com
Websites
A Website for sharing information,
Blogs http://www.narendramodi.in
ideas and views.
Informational Provides information on various
https://www.wikipedia.org
Websites topics.
Directory A Source to access all Websites at
https://goidirectory.nic.in
Websites all levels and from all sectors.
E-commerce
Business Websites https://www.irctc.co.in
Websites
Web browser: A browser is a software application used to locate, retrieve and display content
of Web pages, images, video and other files. The browser contacts the Web server and
requests information and Web server sends the
information back to the Web browser which displays the
results on the computer. Example of Web browser are
Mozilla firefox, Internet explorer, Google chrome ,epic etc.
Opening of Webpages and websites: Opening a website is very easy process. First of all you
must have a working internet connection on your computer.
Search a browser which installed in your computer like Mozilla firefox, Internet
explorer, Google chrome ,Epic, opera etc. double click on the icon of browser and type
84
the name of website in address bar which you want to open. E.g
www.kvsangathan.nic.in (See below).
Use of Search Engine: Search engines are websites that sea rch the internet for you
and give you a list of search results. Search engines can
search for more than just written information. Depending
on the search engine you’re using, you might also be able
to search for other online content like images, video
content, books and news, as well as products and services.
You do not always have to know a website’s address in
order to use the Internet. It is important to know how to
search for information. One of the best methods to search is to use a search engine. You
can use a search engine to help you find what you're looking for. You can also search
for online maps and directions to help plan your travel from one place to another.
Example: Google, Infoseek, Excite, Lycos, AltaVista etc.
85
Email (Electronic Mail): Email is like sending a letter,, you can send the email and it
get to the other person's email account within seconds. If you have an email address,
you can email anyone else who has an email address, including government agencies
and lots of different kinds of businesses.
You can create one or more email addresses. When you create a new email account,
you'll have to pick email addresses that haven't already been chosen by someone else.
Let’s see how you can create an Email account.
In the following example I am creating a new email account in rediff.com but you can
your create email account through any website
which offers free email creation like Google,
yahoo, Hotmail etc.
86
Now, you can send or receive emails with this ID. For writing new email, use Write Mail
or Compose option and to check the Incoming Email list, see the option Inbox.
Social media sites: A social media site is a platform to build social networks and social
relations among people who share similar interests, activities, backgrounds or real-life
connections. Social media sites are web-based services that allow individuals to create a
public profile, create a list of users with whom to share
connections, and view and cross the connections within
the system. Social media sites incorporate mobile
connectivity, photo & video sharing and blogging. Some
popular social media sites are Facebook, twitter,
LinkedIn, Google Plus+, Instagram and Flickr.
Advantages of Social Media sites:
1. Social networking provides medium for self-expression.
2. Social media sites helps people stay in touch that might not do it otherwise.
3. Social media sites are used to help advertise goods and services.
4. Social media sites provide platform for job searches.
87
Disadvantages of Social Media sites:
1. Social media sites takes time away from other activities and can take over from real
time interaction.
2. Social media sites extend the gap between people who have access to computer
technology and those that don't.
3. Social media sites can be used to promote organized crime.
4. When social media sites are used excessively or in the wrong way, it could have
serious detrimental outcomes on both mental and even physical health of individuals.
88
Lesson-1
Computer Security
Threats to computer Security
What do they mean by a threat?
A threat, in the context of computer security, You will learn
• Viruses: A virus is a small piece of software that piggybacks on real programs. For example, a virus
might attach itself to a program such as a spreadsheet program. Each time the spreadsheet program
runs, the virus runs, too, and it has the chance to reproduce (by attaching to other programs) or
wreak havoc.
• E-mail viruses: An e-mail virus travels as an attachment to e-mail messages, and usually replicates
itself by automatically mailing itself to dozens of people in the victim's e-mail address book. Some e-
mail viruses don't even require a double-click -- they launch when you view the infected message in
the preview pane of your e-mail software.
Page |1
• Trojan horses: A Trojan horse is simply a computer program. The program claims to do one thing (it
may claim to be a game) but instead does damage when you run it (it may erase your hard disk).
Trojan horses have no way to replicate automatically.
• Worms: A worm is a small piece of software that uses computer networks and security holes to
replicate itself. A copy of the worm scans the network for another machine that has a specific security
hole. It copies itself to the new machine using the security hole, and then starts replicating from there,
as well.
Virus History
Traditional computer viruses were first widely seen in the late 1980s,
Some Virus the Melissa virus in March 1999 was spectacular in its attack. Melissa spread in Microsoft
Word documents sent via e-mail.
The ILOVEYOU virus, which appeared on May 4, 2000, was even simpler. It contained a piece of
code as an attachment. People who double-clicked on the attachment launched the code. It then sent
copies of itself to everyone in the victim's address book and started corrupting files on the victim's
machine.
Worms: A worm is similar to a virus by design and is considered to be a sub-class of a virus. Worms
spread from computer to computer, but unlike a virus, it has the capability to travel without any human
action. A worm takes advantage of file or information transport features on your system, which is what
allows it to travel unaided.
Worms use up computer processing time and network bandwidth when they replicate,
and often carry payloads that do considerable damage.
Some example of worms: A worm called Code Red made huge headlines in 2001.
The Slammer worm (which caused mayhem in January 2003) exploited a hole in Microsoft's SQL
server.
A worm called Storm, which showed up in 2007, immediately started making a name for itself. Storm
used social engineering techniques to trick users into loading the worm on their computers.
Trojan Horse: A Trojan Horse is full of as much trickery as the mythological Trojan Horse it was
named after. The Trojan Horse, at first glance will appear to be useful software but will actually do
damage once installed or run on your computer. Some Trojan are designed to be more annoying than
malicious (like changing your desktop, adding silly active desktop icons) or they can cause serious
damage by deleting files and destroying information on your system. Trojans are also known to create
Page |3
a backdoor on your computer that gives malicious users access to your system, possibly allowing
confidential or personal information to be compromised. Unlike viruses and worms, Trojans do not
reproduce by infecting other files nor do they self-replicate.
Firewall
A firewall is a system designed to prevent unauthorized access to or from a private network. Firewalls
can be implemented in both hardware and software, or a combination of both. All messages entering
or leaving the intranet pass through the firewall, which examines each message and blocks those that
do not meet the specified security criteria.
Page |4
Common Firewall Techniques:
There are several types of firewall techniques that will prevent potentially harmful information from
getting through:
1. Packet Filter
Looks at each packet entering or leaving the network and accepts or rejects it based on user-defined
rules. Packet filtering is fairly effective and transparent to users, but it is difficult to configure. In
addition, it is susceptible to IP spoofing.
2. Application Gateway
Applies security mechanisms to specific applications, such as FTP and Telnet servers. This is very
effective, but can impose a performance degradation.
3. Circuit-level Gateway
Applies security mechanisms when a TCP or UDP connection is established. Once the connection
has been made, packets can flow between the hosts without further checking.
4. Proxy Server
Intercepts all messages entering and leaving the network. The server effectively hides the true
network addresses.
In practice, many firewalls use two or more of these techniques in concert. A firewall is
considered a first line of defense in protecting private information.
Cyber Crime
Cybercrime encompasses any criminal act dealing with computers and networks (called hacking).
Additionally, cybercrime also includes traditional crimes conducted through the Internet. For example;
hate crimes, telemarketing and Internet fraud, identity theft, and credit card account thefts are
considered to be cybercrimes when the illegal activities are committed through the use of a computer
and the Internet.
Page |5
Computer as a target
These crimes are committed by a selected group of criminals. Unlike crimes using the computer as a
tool, these crimes require the technical knowledge of the perpetrators. There are numerous crimes of
this nature committed daily on the internet:
Crimes that primarily target computer networks or devices include:
• Computer viruses
• Denial-of-service attacks
• Malware (malicious code)
Computer Ethics
Computer Ethics is set of moral principles that regulate the use of computers. Some common issues
of computer ethics include intellectual property rights (such as copyrighted electronic content), privacy
concerns, and how computers affect society.
Page |6
Hackers and Crackers
A hacker is a person intensely interested in the arcane and recondite workings of any computer
operating system. Hackers are most often programmers. As such, hackers obtain advanced
knowledge of operating systems and programming languages. They might discover holes within
systems and the reasons for such holes. Hackers constantly seek further knowledge, freely share
what they have discovered, and never intentionally damage data.
A cracker is one who breaks into or otherwise violates the system integrity of remote machines with
malicious intent. Having gained unauthorized access, crackers destroy vital data, deny legitimate
users service, or cause problems for their targets. Crackers can easily be identified because their
actions are malicious.
1. A white hat hacker breaks security for non-malicious reasons, perhaps to test their own
security system
2. A "black hat" hacker is a hacker who "violates computer security for little reason beyond
maliciousness or for personal gain"
3. A grey hat hacker lies between a black hat and a white hat hacker. A grey hat hacker may surf
the Internet and hack into a computer system for the sole purpose of notifying the administrator
that their system has a security defect,
4. A social status among hackers, elite is used to describe the most skilled.
5. A blue hat hacker is someone outside computer security consulting firms who is used to bug-
test a system prior to its launch, looking for exploits so they can be closed
CyberLaw
Cyber means the use of Internet technologies and computers it includes computers, networks,
software, data storage devices, Internet, websites, emails, ATM machines etc. To protect the
cybercrime over Internet, this law is Passed to protect the Internet cybercrime. This law is approved
by the government.
Page |7
Cyber law Includes:
1. Cybercrimes
2. Electronic and Digital Signatures
3. Intellectual Property
4. Data protection and privacy
Importance of Cyber Law: Companies now be able to carry out electronic commerce using the legal
infrastructure provided by the Act allows Government to issue notification on the web thus heralding
e-governance Protect Computer fraud and Unauthorized access. Consumers are now increasingly
using credit cards for shopping. Most people are using email, cell phones and SMS messages for
communication as well as Deal with Internet Banking Transactions.
There are two different types of backup supported: File backup and system image.
1. File backups are saved to ZIP files. Two methods of file backup are supported: The first,
normal backup, stores everything selected for backup. The second, incremental backup stores
only files that are changed after a previous backup.
2. System image: The image-based full system backup option, called Complete PC Backup in
Windows Vista or system image in Windows 7, allows for the imaging of the entire system
including operating system and data volumes. The backed up image can later be restored
through the Windows Recovery Environment either to the same computer or to a new
computer of different brand and type.
Page |8
To back up your files
1. Open Backup and Restore by clicking the Start button , clicking Control Panel,
clicking System and Maintenance, and then clicking Backup and Restore.
• If you've never used Windows Backup before, click Set up backup, and then follow the
steps in the wizard.
• If you've created a backup before, you can wait for your regularly scheduled backup to
occur, or you can manually create a new backup by clicking Back up now.
1. Open Backup and Restore by clicking the Start button , clicking Control Panel,
clicking System and Maintenance, and then clicking Backup and Restore.
SUMMARY
1. A threat, in the context of computer security, refers to anything that has the potential to cause
serious harm to a computer system.
2. Computer Virus are nothing but computer program that do unwanted things with your computer
resources e.g. you are working on PC and you are repeatedly receiving annoying message.
3. Viruses are of many types like Email viruses, Trojan Horse, Worm, ILOVEYOU.
4. We can protect our system by Keeping The Operating System Updated, Use a Firewall,
Anti-virus software is crucial to preventing virus attacks, but this strategy only works if users
update their software.
5. A firewall is a system designed to prevent unauthorized access to or from a private network.
Firewalls can be implemented in both hardware and software, or a combination of both.
6. Common Firewall techniques are Packet Filter, Application Gateway, Circuit-level Gateway,
Circuit-level Gateway, and Proxy Server.
Page |9
7. Any criminal act dealing with computers and networks (called hacking). Additionally, cybercrime also
includes traditional crimes conducted through the Internet referred to as Cyber Crime.
8. Computer Ethics is set of moral principles that regulate the use of computers.
9. A hacker is a person intensely interested in the arcane and recondite workings of any
computer operating system. Hackers are most often programmers.
10. A cracker is one who breaks into or otherwise violates the system integrity of remote
machines with malicious intent.
11. Cyber means the use of Internet technologies and computers it includes computers, networks,
software, data storage devices, Internet, websites, emails, ATM machines etc.
12. Backup and Restore (formerly Windows Backup and Restore Center) is a component of
Microsoft Windows introduced in Windows Vista and included in later versions that allows
users to create backups and restore from backups.
13. Two different types of backup supported: File backup and system image.
EXERCISES
P a g e | 10
B. Find true or false:
i. Computer viruses are nothing but computer program that do unwanted things.
ii. A hacker is hacking software which access in sensitive information from your
computer.
iii. Backup and Restore is a component of Microsoft Windows.
iv. Cyber means the use of internet technologies and computers.
v. We shall use a computer to harm other people is one of the ethics of computer.
P a g e | 11
Lesson-2
Hyper Text Markup Language (HTML)
HTML:
You will learn
HTML is the building block for web pages.
Prerequisites: You will need a text editor,
such as Notepad and an Internet browser, Heading (H1 to H6)
<Br>, <hr>
such as Internet Explorer or Netscape. ,<comment>
Background Color
,font tag(size, face,
What is an html File? color)
i. HTML is a format that tells a computer Text alignment
(center, left , right)
how to display a web page.
ii. An HTML file is a text file containing
small markup tags
iii. The markup tags tell the Web browser
how to display the page
iv. An HTML file must have an htm or html
file extension
P a g e | 12
Tag Description
<head>...</head>This tag represents the document's header which can keep other HTML tags like
<title>, <link> etc.
<title> The <title>tag is used inside the <head> tag to mention the document title.
<body> This tag represents the document's body which keeps all the contents of a web page- text,
images, sound etc.
<br> This tag is used to insert new line or insert enter in html
Bold, Italics, Underline :<b> tag is used to make a text bold in html.
P a g e | 13
Background color and text color: <body bgcolor ="yellow" > tag is used to change the
background color of an html page and <body text=”red”> changes text color.
1.click Start-> All Programs->Accessories. Open notepad and type the code given below
<html>
<head>
</title>
</head>
<body>
</body>
</html>
Assignment Question
Q. Write the code to create the following Webpage with background color ‘green’ and text color ‘red’
My School
Im a student of K.V,NFR Maligaon. I read in class 7.
<html>
<head>
<title>My Webpage
</title>
</head>
</body>
</html>
Q. Write an html code to show the working of various Paragraph alignment tags
P a g e | 15
<html>
<head>
<title>
Paragraph in html
</title>
</head>
<body>
</body>
</html>
1. Internal:
Steps: 1. Open My Pictures or Sample Pictures or any folder containing pictures Copy the
picture you want
P a g e | 16
5.Open the text document and type the code given below.
<html>
<head>
<title>
</title>
</head>
<body bgcolor="yellow">
</body></html>
2. External: Here we type the location or address of the picture where it is, instead of simply
writing the name of the picture.
Steps:
<html>
<head>
P a g e | 17
<title>
</title>
</head>
<body bgcolor="yellow">
</body>
</html>
To insert images with adjusted height and width: We can change the width and height of the
inserted image in our webpage by simply writing the ‘width’ and ‘height’ options inside the <img> tag
SUMMARY
1. HTML is a format that tells a computer how to display a web page; it is the building block for
web pages.
2. HTML tags normally come in pairs like <b> and </b>.
3. <html> This tag marks the start of an html document
4. <head>...</head>This tag represents the document's header which can keep other HTML tags
like <title>, <link> etc.
5. <title> The <title>tag is used inside the <head> tag to mention the document title.
6. <body> This tag represents the document's body which keeps all the contents of a web page-
text, images, sound etc.
7. <h1> ,<h2>,……<h6>This tag represents the heading tags of different sizes.
P a g e | 18
8. <center> This tag is used to write a line or text in center
9. <p> This tag represents a paragraph.
10. <img> tag is used to insert images in webpage
EXERCISES
i. What is HTML?
ii. Name any two attributes used with the BODY tag.?
iii. Write the HTML code to set the background color to yellow.?
iv. How would you insert image in an Html document?
v. What does the ‘n’ in the <Hn> tag indicate?
P a g e | 19
In the lab
1. Ankita has made the HTML document shown below, which displays headings in different
Sizes. Write the HTML code for creating a similar document.
2. Anita wants to create simple Web page on Input devices. Help her by listing the steps required
for creating the web page.
P a g e | 20
Lesson-3
You will learn
HTML LISTS
Lists in HTML Paragraph formatting
Tags
1. Unordered Lists - An unordered list has no List Tags
specific numbering or ordering. It starts with Order (start and type
attribute) and Un order
the <ul> tag. Each list item starts with the <li>
List
tag.Example: Create the following List in HTML Background Image and
other Image Insertion in
<html> Web Page with alignment
Creation of table
<head>
Anchor Tag
Hyper Link
<title>
Unordered list
</title>
<head>
<body>
<ul>
Unordered List with Bullets
<li>Coffee</li>
I like to drink the following:
<li>Tea</li>
• Coffee
<li>Milk</li> • Tea
</ul> • Milk
</body>
</html>
P a g e | 21
11. Ordered Lists - An ordered list can be numerical or alphabetical in a specific order.
<html>
Ordered List with Numbers
<head>
I like to drink the following:
<title>
1. Coffee
Ordered list 2. Tea
3. Milk
</title>
</head>
<body>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Ordered list styling- To change the starting number from default 1 to any number we use the ‘start’
option.
To Change from numbers to alphabet or to roman numbers we use the ‘type’ option.
P a g e | 22
</ol>
TABLES IN HTML:
HTML tables allow web authors to arrange data like text, images, links, other tables, etc. into rows
and columns of cells. The HTML tables are created using the <table> tag in which
the <tr> tag is used to create table rows and <td> tag is used to create data cells.
Month Saving
January $100
February $75
<html>
<head>
<title>
Table in html
</title>
</head>
<body>
<table>
<tr>
<td>Month</td>
<td>Savings</td>
</tr>
<tr>
<td>January</td>
P a g e | 23
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$75</td>
</tr>
</table>
</body>
</html>
5. Background: It is used to give image in the background. This attribute takes URL of the file as its
value.
7. Height and Width: These attributes are used to specify the height and width of the table in pixel
P a g e | 24
Stretching a cell over multiple rows or columns is refered to as spanning. Two or more adjacent rows
can be combined together to form a single row using the rowspan attribute. Two or more adjacent
columns can be combined together to form a single columns using the colspan attribute.
<html>
<Table border=1>
<tr><td>Dramatics</td><td>Rs. 350</td></tr>
</Table>
</html>
Output :-
P a g e | 25
Anchor Tag:
The ‘a’ or anchor tag. Hyperlinks, or links, are how you move around the web. An <a> or anchor tag is
how you make hyperlinks in HTML. The ‘a’ or anchor tag is an elegantly simple and powerful tool.
There are two ways two insert hyperlinks in html:
1. Internal link –
Steps: 1. Open My Pictures or Sample Pictures or any folder containing pictures or songs or any
file, Copy the file you want
5.Open the text document and type the code given below.
<html>
<head>
<title>
Links in HTML
</title>
</head>
<body>
</html>
2. External: Here we type the location or address of the picture or file where it is, instead of
simply writing the name of the picture.
Steps:
<html>
<head>
<title>
</title>
</head>
<body >
P a g e | 27
</body>
</html>
To open webpages using hyperlinks: We can open different webpages by simply clicking on a
hyperlink by providing the address of the webpage using <a> tag
To change HTML Link Color: We can change the color of the hyperlinks by using the following
options in the <body> tag.
SUMMARY
P a g e | 28
11. Two or more adjacent rows can be combined together to form a single row using the rowspan
attribute.
12. Two or more adjacent columns can be combined together to form a single columns using the
colspan attribute.
13. An <a> or anchor tag is how you make hyperlinks in HTML.
14. There are two ways two insert hyperlinks in html : Internal Link, External Link.
EXERCISES
In the lab
1. The student of Lotus Public School wants to create the following web page related to the
outdoor activities help them to create the code in HTML.
2. Create your class time table with class teacher name using <TABLE> in HTML , You are free to
use colors of your own choice.
3. Anita is trying to create two web pages computer.html and definition.html where computer.html
is the name and are linked to definition.html. She wants that a click on name and it should
P a g e | 30
Lesson-1
Algorithm You will learn
Use of algorithm in
Use of algorithm in programming programming
Developing algorithm
to solve a particular
Developing algorithm to solve particular problem problem
1|Page
Steps:
1. Pick up the phone and listen for a dial tone
2. Press each digit of the phone number on the phone
3. If busy, hang up phone, wait 5 minutes, jump to step 2
4. If no one answers, leave a message then hang up
5. If no answering machine, hang up and wait 2 hours, then jump to step 2
6. Talk to friend
7. Hang up phone
Steps:
1. Take numbers a, b, c.
2. Input the values of a and b
2|Page
3. C=a+b
4. Print c*c
Steps:
1. Take numbers l, b, c, d.
2. Input the values of l and b
3. c=l*b
4. d=2*c
5. Print d
Conditions in Algorithm
Steps:
1. Take a number age.
2. Input the age of the person
3. If(age>=18) goto step 4
3|Page
Else
Goto step 5
4. Print “You can vote”
5. Print “You can’t vote”
Algorithm: To give a bonus of Rs 1000 to those employees whose salary is more than Rs
5000
Input: Salary.
Output: New Salary
Steps:
1. Take numbers salary and total.
2. Input the salary of the person
3. If(salary>=5000) goto step 4
Else
Goto step 5
4. total=salary+1000
5. total=salary+0
6. Print total
4|Page
SUMMARY
EXERCISES
5|Page
Lesson-2
Flow Char You will learn
About flow chart
Various types of box
About flow chart used in flow
chart and their
A flowchart is a type of diagram that represents an algorithm or use(terminal box,
input/output box,
process, showing the steps as boxes of various kinds, and their processing box
order by connecting them with arrows. This diagrammatic , decision box)
Question based on
representation illustrates a solution to a given problem. sequence , selection
and iteration
6|Page
Various types of box used in flow chart:
7|Page
Question based on sequence, selection and iteration
Q 1. Draw a flowchart to find the sum of two numbers
8|Page
Q 2. Draw a flowchart to find bigger number among two numbers (selective)
9|Page
SUMMARY
1. A flowchart is a type of diagram that represents an algorithm or process, showing the
steps as boxes of various kinds, and their order by connecting them with arrows.
2. Flowline symbol used to connect the symbols and indicate the flow of logic.
3. Terminal symbol is used to represent the beginning (Start) or end (End) of task.
6. Decision making symbol used to represent any logic and comparisons operations.
EXERCISES
1. What is flowchart?
10 | P a g e
Lesson-8
E-Commerce
You will learn
EDI(Electronic Data Interchange)
EDI(Electronic Data
Interchange)
Electronic data interchange (EDI) is an electronic communication What is E-Commerce and E-
Greetings ?
method that provides standards for exchanging data via any Influence on user
What factor one should
electronic means. Two different companies or organizations, keep in mind while doing e-
commerce, Websites
even in two different countries, can electronically exchange Example
documents (such as purchase orders, invoices, shipping notices,
71 | P a g e
• Improved customer service.
• Increased productivity/efficiency.
• Access to international markets.
An E-card is similar to a postcard or greeting card, with the primary difference being that it is created
using digital media instead of paper or other traditional materials. E-cards are made available by
publishers usually on various Internet sites, where they can be sent to a recipient, usually via e-mail.
It also considered more environmentally friendly compared to traditional paper cards. E-card
businesses are considered environmentally friendly because their carbon footprint is generally much
lower compared to paper card companies and because paper is not used in the end product.
E-cards can be easily sent to many people at once or extensively personalized by the sender
Typically, an E-card sender chooses from an on-line catalog of E-cards made available on a
publisher's web site. After selecting a card, the sender can personalize it to various degrees by
adding a message, photo, or video. Finally, the sender specifies the recipient's e-mail address and
the web site delivers an e-mail message to the recipient on behalf of the sender.
72 | P a g e
Types of E-card:
• Flash animation
This type of E-card is based on two-dimensional vector animation controlled with
a scripting language. Flash animated greeting cards can include interactivity, for
example, asking the viewer to choose a picture to animate;
• Video E-cards
"Video E-cards" use a combination of personalized text and video to convey the
message to the recipient.
• Mobile E-cards
With the advance in mobile technologies, Multimedia Messaging Service (MMS)
which is basically picture SMS, became more and more popular.
• Web based multi-media E-cards
The web-based card creation has been evolving becoming more creative. The
user can create greeting cards online choosing backgrounds, drag and drop
images, animations, smiles and write text that look like handwriting.
• E-cards games
Some E-cards include interactive games.
Influence on user
ADVANTAGES OF ECOMMERCE
• Faster buying/selling procedure, as well as easy to find products.
• Buying/selling 24/7.
• More reach to customers, there is no theoretical geographic limitations.
• Low operational costs and better quality of services.
• No need of physical company set-ups.
• Easy to start and manage a business.
• Customers can easily select products from different providers without moving around physically.
73 | P a g e
DISADVANTAGES OF ECOMMERCE
• Any one, good or bad, can easily start a business. And there are many bad sites which eat up
customers’ money.
• There is no guarantee of product quality.
• Mechanical failures can cause unpredictable effects on the total processes.
• As there is minimum chance of direct customer to company interactions, customer loyalty is
always on a check.
• There are many hackers who look for opportunities, and thus an ecommerce site, service,
payment gateways, all are always prone to attack.
2 Security
Online transactions are inherently more insecure than those conducted in person because
there's no way to guarantee that the person making the payment is the actual owner of the
credit card used.
3 Price Wars
Merchants used to selling at their shop may often find selling online an extremely competitive
marketplace. or products are purchased from illegitimate retailers because they had the best
price.
74 | P a g e
4 Returns And Complaints
Selling online means usually a higher return rate on products than when the purchase was
conducted in person.
SUMMARY
EXERCISES
75 | P a g e
Lesson-10
Downloading/Uploading
You will learn
Download When you connect to the internet, the download speed is the pace at which data
(websites, programmers, music etc.) is transferred from another computer to your own. Currently,
when it comes to home broadband, download speeds range from 8 Mbps to 100 Mbps
Upload speed on the other hand is the speed at which data (such as your pictures and videos) is
uploaded to the internet – perhaps to put onto a social networking site such as Facebook, or file-
sharing site such as Flickr; Essentially, the upload is going in the opposite direction to the download –
from your computer to someone else’s.
Broadband upload speeds are generally much slower than download speeds. The reason for this is
that people generally do far more downloading than uploading, and as such downloading is given
priority by internet service providers (ISPs).
81 | P a g e
Lesson-3
ADDING STYLES TO WEB PAGES
USNIG CSS
You will learn
Review of HTML
Review of HTML
World Wide Web(WWW) • World Wide Web(WWW)
• Headers
WORLD WIDE WEB –The World Wide Web is a worldwide • Body and Titles
information service on the Internet. The World Wide Web • Headings
• Paragraphs
or the Web, as it is popularly known uses special software • Tables
called a Browser (client) and TCP/IP, HTTP and a Web server • Lists
Adding Style Sheets
to function. • Setting the default style sheet
language
Headers
• Inline style information
Information placed in this section is essential to the inner • Header style information: the
“STYLE” element.
working of the document and has nothing to do with the
• Media types
content of the document. All the information placed with External Style Sheets
in the <HEAD></HEAD> tags is not displayed in the browser. • Preferred and alternate style
sheets
• Specifying
26 | Pexternal
a g e style sheets
CSS Properties-Border, box, font,
margin
CSS Classes
The HTML tags used to indicate the start and end of the head
section are:
<HEAD>
<TITLE>…. </TITLE>.
</HEAD>
The tags used to indicate the start and end of the main body of textual information are :
<BODY>
……..
……..
</BODY>
A web page would have a title that describe what the page is about without being too wordy. This can
be achieved by using the TITLE tag.
<TITLE>…………………………………..</TITLE>
Headings
Paragraphs
HTML documents are divided into paragraphs. Paragraphs are defined with the <p> tag.
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Tables
• A table is divided into rows with the <tr> tag. (tr stands for table row)
• A row is divided into data cells with the <td> tag. (td stands for table data)
• A row can also be divided into headings with the <th> tag. (th stands for table
heading)
• The <td> elements are the data containers in the table.
• The <td> elements can contain all sorts of HTML elements like text, images, lists,
other tables, etc.
<tr>
<td>Rajesh</td>
<td>Singh</td>
<td>60</td>
</tr>
</table>
Vikram Vats 98
Rajesh Singh 60
Lists
The most common HTML lists are ordered and unordered lists:
28 | P a g e
An ordered list starts with the <OL> tag. Each list item starts with the <LI> tag. The list items are
marked with numbers.
<OL>
<LI>Coffee</LI>
<LI>Milk</LI>
</OL>
1. Coffee
2. Milk
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items are
marked with bullets (typically small black circles).
<UL>
<LI>Coffee</LI>
<LI>Milk</LI>
</UL>
• Coffee
• Milk
Coffee
CSS is a style sheet language used to determine the formatting of an HTML document.
Using separate style sheets for an entire site, leveraging semantic markup and identifiers like ids (for
unique page elements) and classes (for multiple, like elements) a developer can apply styles across a
whole site while updating a single (cacheable) file.
We should use the META element to set the default style sheet language for a document. For
example, to set the default to CSS, We should put the following declaration in the HEAD of their
documents:
The default style sheet language may also be set with HTTP headers. The above META declaration
is equivalent to the HTTP header:
Content-Style-Type: text/css
User agents should determine the default style sheet language for a document according to the following steps
(highest to lowest priority):
1. If any META declarations specify the "Content-Style-Type", the last one in the character stream
determines the default style sheet language.
2. Otherwise, if any HTTP headers specify the "Content-Style-Type", the last one in the character stream
determines the default style sheet language.
3. Otherwise, the default style sheet language is "text/css".
Documents that include elements that set the style attribute but which don't define a default style sheet
language are incorrect. Weing tools should generate default style sheet language information (typically
a META declaration) so that user agents do not have to rely on a default of "text/css".
Attribute definitions
style = style [CN]
This attribute specifies style information for the current element.
30 | P a g e
The syntax of the value of the style attribute is determined by the default style sheet language
This CSS example sets color and font size information for the text in a specific paragraph.
In CSS, property declarations have the form "name: value" and are separated by a semi-colon.
To specify style information for more than one element, we should use the STYLE element
<body>
<h1 >My First CSS Example</h1>
<p>This is a paragraph.</p>
</body>
</html>
31 | P a g e
<HEAD>
32 | P a g e
Example of Inline CSS
<html>
<head>
<style>
body { background-color: #d0e4fe;}
h1 {
color: orange;
text-align: center;
font-size: 80px;
}
p{
font-family: "Times New Roman";
font-size: 20px;
border: thick dashed blue;
}
</style>
</head>
<html>
<body>
<h1 style="color:Blue” >This is a Blue Heading</h1>
<p style="background:#ccc; color:#fff; border: solid black 1px;">This is a Paragraph</p>
<p style="font-size:large;line-height:1.2em;color:#ff9900">This text has been styled using inline style
sheets.</p>
<h1 ALIGN="center" STYLE="background: #000080; font: 36pt/40pt courier; font-variant: small-caps;
border: thick dashed blue">Welcome to my home page!</h1>
</body>
</html>
33 | P a g e
Media types
HTML allows We to design documents that take advantage of the characteristics of the media where
the document is to be rendered (e.g., graphical displays, television screens, handheld devices,
speech-based browsers, braille-based tactile devices, etc.). By specifying the media attribute, We
allow user agents to load and apply style sheets selectively. Please consult the list of recognized
media.
The following sample declarations apply to H1 elements. When projected in a business meeting, all
instances will be blue. When printed, all instances will be centered.
We may separate style sheets from HTML documents. This offers several benefits:
• We and Web site managers may share style sheets across a number of documents (and sites).
• We may change the style sheet without requiring modifications to the document.
• User agents may load style sheets selectively (based on media descriptions).
HTML allows We to associate any number of external style sheets with a document. The style sheet
language defines how multiple external style sheets interact (for example, the CSS "cascade" rules).
• We may specify a number of mutually exclusive style sheets called alternate style
sheets. Users may select their favorite among these depending on their preferences. For
instance, user may specify one style sheet designed for small screens and another for users
with weak vision (e.g., large fonts). User agents should allow users to select from alternate
style sheets.
• We may group several alternate style sheets (including the user's preferred style sheets) under
a single style name. When a user selects a named style, the user agent must apply all style
sheets with that name.
• We may also specify persistent style sheets that user agents must apply in addition to any
alternate style sheet.
• User agents must respect media descriptors when applying any style sheet.
• User agents should also allow users to disable the user’s style sheets entirely, in which case
the user agent must not apply any persistent or alternate style sheets.
34 | P a g e
Specifying external style sheets
We specify external style sheets with the following attributes of the LINK element:
• Set the value of href to the location of the style sheet file. The value of href is a URI.
• Set the value of the type attribute to indicate the language of the linked (style sheet) resource.
• Specify that the style sheet is persistent, preferred, or alternate:
o To make a style sheet persistent, set the rel attribute to "stylesheet" and don't set the title attribute.
o To make a style sheet preferred, set the rel attribute to "stylesheet" and name the style sheet with
the title attribute.
o To specify an alternate style sheet, set the rel attribute to "alternate stylesheet" and name the style
35 | P a g e
Example of External CSS
3: Create another text document and type the html code below and save it as webpage.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>The style of this document is a combination of an external stylesheet, and internal style</p>
</body>
</html>
In this example, we first specify a persistent style sheet located in the file mystyle.css:
Setting the title attribute makes this the user's preferred style sheet:
Adding the keyword "alternate" to the rel attribute makes it an alternate style sheet:
If the CSS file is not in the same directory, you can also specify its absolute path:
Cascading style sheet languages such as CSS allow style information from several sources to be
blended together. However, not all style sheet languages support cascading. To define a cascade,
authors specify a sequence of LINK and/or STYLE elements. The style information is cascaded in the
order the elements appear in the HEAD.
36 | P a g e
CSS Font - CSS font properties define the font family, boldness, size, and the style of a text.
font-family:"Times New Roman", Times, serif;
CSS Borders - you can create rounded borders, add shadow to boxes, and use an image as a
border - without using a design program, like Photoshop.
div
{
border:2px solid;
border-radius:25px;
}
CSS Classes
ID
The id selector is used to specify a style for a single, unique element.The id selector uses the id
attribute of the HTML element, and is defined with a "#".The style rule below will be applied to the
element with id="para1":
#para1
{
text-align:center;
color:red;
}
Class Selectors
The class selector is used to specify a style for a group of elements. Unlike the id selector, the class
selector is most often used on several elements..center {text-align:center;}
37 | P a g e
SUMMARY
38 | P a g e
Lesson-4
WEB SCRIPTING JAVA SCRIPT
Introduction and History of Java Script You will learn
allows you to build interactivity into otherwise static HTML pages. Variables & Operators
Variable constraints,
The general-purpose core of the language has been embedded in
Types of Operators:
logical, arithmetic,
Netscape, Internet Explorer, and other web browsers.
relational
Decision Making using if
Client-side JavaScript is the most common form of the language. & Switch
Iteration – Loops
The script should be included in or referenced by an HTML Window Object
Popup Boxes – alert, confirm
document for the code to be interpreted by the browser. etc.
It means that a web page need no longer be static HTML,
but can include programs that interact with the user, control the browser, and dynamically create
HTML content.
41 | P a g e
The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and
other web browsers
• Less server interaction: You can validate user input before sending the page off to the
server. This saves server traffic, which means less load on your server.
• Immediate feedback to the visitors: They do not have to wait for a page reload to see if they
have forgotten to enter something.
• Increased interactivity: You can create interfaces that react when the user hovers over them
with a mouse or activates them via the keyboard.
• Richer interfaces: You can use JavaScript to include such items as drag-and-drop
components and sliders to give a Rich Interface to your site visitors.
JavaScript Syntax:
A JavaScript consists of JavaScript statements that are placed within the <script>... </script> HTML
tags in a web page.
JavaScript code
</script>
• Language: This attribute specifies what scripting language you are using. Typically, its value
will be JavaScript.
• Type: This attribute is what is now recommended to indicate the scripting language in use and
its value should be set to "text/javascript".
42 | P a g e
Your First JavaScript Script:
Let us write an example to print out "Hello World".
<html>
<body>
<!--
document.write("Hello World!")
//-->
</script>
Used to write text, HTML, or both
</body>
</html>
Hello World!
JavaScript Data Types: One of the most fundamental characteristics of a programming language is
the set of data types it supports. These are the type of values that can be represented and
manipulated in a programming language.
JavaScript Variables
Variable is the stored memory location that can hold a value in it. Variables are declared
with the var keyword. Storing a value in a variable is called variable initialization.
43 | P a g e
Example:
<script type="text/javascript">
<!--
var money;
money = 2000.50;
//-->
</script>
The scope of a variable is the region of your program in which it is defined. JavaScript variable will
have only two scopes.
• Global Variables: A global variable has global scope which means it is defined everywhere in
your JavaScript code.
• Local Variables: A local variable will be visible only within a function where it is defined.
Function parameters are always local to that function.
<script type="text/javascript">
<!--
function checkscope( ) {
document.write(myVar);
//-->
</script>
44 | P a g e
This produces the following result:
Local
• You should not use any of the JavaScript reserved keyword as variable name.
• JavaScript variable names should not start with a numeral (0-9). They must begin with a letter
or the underscore character.
• JavaScript variable names are case sensitive.
The following are reserved words in JavaScript. They cannot be used as JavaScript variables,
functions, methods, loop labels, or any object names.
45 | P a g e
• Types of Operators: logical, arithmetic, relational
• Arithmetic Operators
• Comparision Operators
• Logical (or Relational) Operators
• Assignment Operators
• Conditional (or ternary) Operators
46 | P a g e
The Comparison Operators:
== Checks if the value of two operands are equal or not, if (A == B) is not true.
yes then condition becomes true.
> Checks if the value of left operand is greater than the (A > B) is not true.
value of right operand, if yes then condition becomes
true.
< Checks if the value of left operand is less than the value (A < B) is true.
of right operand, if yes then condition becomes true.
>= Checks if the value of left operand is greater than or (A >= B) is not true.
equal to the value of right operand, if yes then condition
becomes true.
<= Checks if the value of left operand is less than or equal to (A <= B) is true.
the value of right operand, if yes then condition becomes
true.
47 | P a g e
The Logical Operators:
Assume variable A holds 10 and variable B holds 20 then:
&& Called Logical AND operator. If both the operands are (A && B) is true.
non zero then then condition becomes true.
! Called Logical NOT Operator. Use to reverses the !(A && B) is false.
logical state of its operand. If a condition is true then
Logical NOT operator will make false.
48 | P a g e
/= Divide AND assignment operator, It divides left C /= A is equivalent to C = C / A
operand with the right operand and assign the result
to left operand
• if statement
• if...else statement
• if...else if... statement.
if statement:
The if statement allows JavaScript to make decisions and execute statements conditionally.
Syntax:
if (expression){
Statement(s) to be executed if expression is true
}
Example:
<script type="text/javascript">
var age = 20;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}
</script>
49 | P a g e
This will produce following result:
if...else statement:
The if...else statement is the next form of control statement that allows JavaScript to execute
statements in more controlled way i.e to choose from given options.
Syntax:
if (expression){
Statement(s) to be executed if expression is true
}else{
Statement(s) to be executed if expression is false
}
Example:
<script type="text/javascript">
var age = 15;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}else{
document.write("<b>Does not qualify for driving</b>");
}
</script>
The if...else if... statement allows JavaScript to make correct decision out of several conditions.
50 | P a g e
Syntax:
if (expression 1){
Statement(s) to be executed if expression 1 is true
}else if (expression 2){
Statement(s) to be executed if expression 2 is true
}else if (expression 3){
Statement(s) to be executed if expression 3 is true
}else{
Statement(s) to be executed if no expression is true
}
Example:
<script type="text/javascript">
var book = "maths";
if( book == "history" ){
document.write("<b>History Book</b>");
}else if( book == "maths" ){
document.write("<b>Maths Book</b>");
}else if( book == "economics" ){
document.write("<b>Economics Book</b>");
}else{
document.write("<b>Unknown Book</b>");
}
</script>
Maths Book
Switch Case: You can use multiple if...else if statements, to perform a multiway branch. However,
this is not always the best solution, especially when all of the branches depend on the value of a
single variable.
51 | P a g e
Syntax: The basic syntax of the switch statement is to give an expression to evaluate and
several different statements to execute based on the value of the expression. The interpreter checks
each case against the value of the expression until a match is found. If nothing matches, a
default condition will be used.
switch (expression)
{
case condition 1: statement(s)
break;
case condition 2: statement(s)
break;
...
case condition n: statement(s)
The break statements indicate to the
break;
interpreter the end of that particular
default: statement(s)
case. If they were omitted, the
}
interpreter would continue executing
each statement in each of the following cases.
<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
switch (grade)
{
case 'A': document.write("Good job<br />");
break;
case 'B': document.write("Pretty good<br />");
break;
case 'C': document.write("Passed<br />");
break;
case 'D': document.write("Not so good<br />");
break;
case 'F': document.write("Failed<br />");
break;
default: document.write("Unknown grade<br />")
52 | P a g e
}
document.write("Exiting switch block");
</script>
<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
switch (grade)
{
case 'A': document.write("Good job<br />");
case 'B': document.write("Pretty good<br />");
case 'C': document.write("Passed<br />");
case 'D': document.write("Not so good<br />");
case 'F': document.write("Failed<br />");
default: document.write("Unknown grade<br />")
}
document.write("Exiting switch block");
</script>
53 | P a g e
Iteration – Loops
A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.
This not only saves you the time and trouble of repeatedly typing the same lines of code, but
also avoids typing errors in the repeated lines.
JavaScript allows you to use the for, while, and do while loops.
JavaScript Code Here The JavaScript code for the loop will be inside the brackets here
1. Initialization: Here we initialize our counter to a starting value. The initialization statement is
executed before the loop begins.
2. Test condition: If condition is true then code given inside the loop will be executed otherwise
loop will come out.
3. Iteration statement: The iteration statement where you can increase or decrease your
counter.
<script type="text/javascript">
<!--
for (var count=1;count<6;count+=1) {
//-->
</script>
54 | P a g e
This will produce following result:
I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!
While loop:
syntax : initialization;
while( condition )
Update expression;
Example:
<script type="text/javascript">
var count = 1;
document.write("Starting Loop" + "<br />");
while (count <= 5)
{
55 | P a g e
document.write("Number : " + count + "<br />");
count++;
}
document.write("Loop stopped!");
</script>
Starting Loop
Number : 1
Number : 2
Number : 3
Number : 4
Number : 5
Loop stopped!
Window Object
JavaScript supports three important types of dialog boxes. These dialog boxes can be used to raise
and alert, or to get confirmation on any input or to have a kind of input from the users.
An alert dialog box is mostly used to give a warning message to the users.
<html>
<head>
<script type="text/javascript">
<!--
function Warn()
56 | P a g e
}
//-->
</script>
</head>
<body>
<form>
</form>
</body>
</html>
Nonetheless, an alert box can still be used for friendlier messages. Alert box gives only one button
"OK" to select and proceed.
A confirmation dialog box is mostly used to take user's consent on any option. It displays a dialog box
with two buttons: OK and Cancel.
57 | P a g e
If the user clicks on OK button the window method confirm() will return true. If the user clicks on the
Cancel button confirm() returns false. You can use confirmation dialog box as follows:
<html>
<head>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
alert("User wants to continue!");
return true;
}else{
alert("User does not want to continue!");
return false;
}
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getConfirmation();" />
</form>
</body>
</html>
58 | P a g e
Prompt Dialog Box
The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus it
enable you to interact with the user. The user needs to fill in the field and then click OK.
This dialog box is displayed using a method called prompt() which takes two parameters (i) A label
which you want to display in the text box (ii) A default string to display in the text box.
This dialog box with two buttons: OK and Cancel. If the user clicks on OK button the window
method prompt() will return entered value from the text box. If the user clicks on the Cancel button the
window method prompt() returns null.
<html>
<head>
<script type="text/javascript">
function getValue(){
var retVal = prompt("Enter your name : ", "your name here");
alert("You have entered : " + retVal );
}
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getValue();" />
</form>
</body>
</html>
59 | P a g e
Output will appear on the screen.
On clicking button ‘Click Me’ prompt dialog box will appear on the screen.
SUMMARY
1. The general-purpose core of the language has been embedded in Netscape, Internet Explorer,
and other web browsers.
2. A JavaScript consists of JavaScript statements that are placed within the <script>... </script>
3. One of the most fundamental characteristics of a programming language is the set of data
types it supports.
4. Variable is the stored memory location that can hold a value in it. Variables are declared with
the var keyword.
5. Storing a value in a variable is called variable initialization.
6. A global variable has global scope which means it is defined everywhere in your JavaScript
code.
7. A local variable will be visible only within a function where it is defined. Function parameters are always
local to that function.
8. You should not use any of the JavaScript reserved keyword as variable name.
60 | P a g e
9. if...else Statements make use of conditional statements that allow your program to make
correct decisions and perform right actions.
10. Switch Case is one of the alternate of multiple if...else if statements.
11. A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.
12. JavaScript supports three important types of dialog boxes. These dialog boxes can be used to
raise and alert, or to get confirmation on any input or to have a kind of input from the users.
13. An alert dialog box is mostly used to give a warning message to the users.
14. A confirmation dialog box is mostly used to take user's consent on any option. It displays a
dialog box with two buttons: OK and Cancel.
15. The prompt dialog box is very useful when you want to pop-up a text box to get user input.
Thus it enable you to interact with the user. The user needs to fill in the field and then click OK.
EXERCISES
63 | P a g e
A database management system stores data, in such a way,
which is easier to retrieve, manipulate and helps to produce
information.
Users
DBMS is used by various users for various purposes. Some may involve in retrieving data and some
may involve in backing it up. Some of them are described as follows:
Administrators: A bunch of users maintain the DBMS and are responsible for administrating the
database. They are responsible to look after its usage and by whom it should be used.
Designer: This is the group of people who actually works on designing part of database. The actual
database is started with requirement analysis followed by a good designing process.
End Users: This group contains the persons who actually take advantage of database system. End
users can be just viewers who pay attention to the logs or market rates or end users can be as
sophisticated as business analysts who take the most of it.
Purpose of RDBMS:
A relational database will allow you to store data organized such that you can store your information
in tables, organized by rows (records) and columns (fields) which you can then store and access as
required.
64 | P a g e
The features of a relational database is storage minimization - you, as a DB designer try and
use the least storage that you can and still be able to access the data efficiently.
If you then need to retrieve any data, you would 'query' the database (ask it) if record exists in
the database or not. This interaction is done via SQL - Structured Query Language - to get the
records (rows) that you need.
By utilizing a well-structured database, you can store a lot of information and retrieve it quickly.
Data Models
Data model tells how the logical structure of a database is modeled. Data Models are fundamental
entities to introduce abstraction in DBMS. Data models define how data is connected to each other
and how it will be processed and stored inside the system.
The very first data model could be flat data-models where all the data used to be kept in same plane.
Because earlier data models were not so scientific, they were prone to introduce lots of duplication
and update anomalies.
1. Hierarchical Model: The hierarchical data model organizes data in a tree structure.
2. Network Model: Some data were more naturally modeled with more than one parent per child.
Therefore, the network model permitted the modeling of many-to-many relationships in data.
Relational Model
The most popular data model in DBMS is Relational Model. It is more
scientific model then others. This model is based on first-order
predicate logic and defines table as an n-any relation.
Concepts
65 | P a g e
Tables: In relation data model, relations are saved in the format of Tables. This format stores the
relation among entities. A table has rows and columns, where rows represent records and columns
represents the attributes
Tuple: A single row of a table, which contains a single record for that relation, is called a tuple.
Relation instance: A finite set of tuples in the relational database system represents relation
instance. Relation instances do not have duplicate tuples.
Relation schema: This describes the relation name (table name), attributes and their names.
Relation key: Each row has one or more attributes, which can identify the row in the relation (table)
uniquely, is called the relation key.
Attribute domain: Every attribute has some pre-defined value scope, known as attribute domain.
Create Table: The CREATE TABLE statement is used to create a table in a database.
Tables are organized into rows and columns and each table must have a name.
66 | P a g e
CREATE TABLE Student
(
RollNo int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
Creating Views: A view is a virtual table. A view can contain all rows of a table or select rows from a
table. A view comes from one or more tables or just a part of table.
Database views are created using the CREATE VIEW statement. Views can be created from a single
table, multiple tables, or another view.
To create a view, a user must have the appropriate system privilege according to the specific
implementation.
+----+------------+--------+----------------+--------------+
| ID | NAME | AGE | ADDRESS | SALARY |
+----+------------+------ +-----------------+--------------+
|1 |Ramesh |32 |Ahmedabad |2000.00 |
|2 |Khilan |25 |Delhi |1500.00 |
|3 | kaushik |23 |Kota |2000.00 |
|4 |Chaitali |25 |Mumbai |6500.00 |
|5 |Hardik |27 |Bhopal |8500.00 |
|6 |Komal |22 | MP |4500.00 |
|7 |Muffy |24 |Indore |10000.00 |
+----+-----------+---------+----------------+--------------+
Now, following is the example to create a view from CUSTOMERS table. This view would be used to
have customer name and age from CUSTOMERS table:
Now, you can query CUSTOMERS_VIEW in similar way as you query an actual table.
Data Manipulation Language (DML) statements are used for managing data within schema objects.
Some examples:
68 | P a g e
SQL DELETE Syntax
DELETE FROM table_name
WHERE some_column=some_value;
Syntax
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name;
Example:
SELECT ZIP
FROM Customers
GROUP BY ZIP
ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set by one or more columns. The ORDER BY
keyword sorts the records in ascending order by default. To sort the records in a descending order,
you can use the DESC keyword.
Union
The SQL UNION query is a SQL query to combine the result sets of 2 or more SQL SELECT
statements. It removes duplicate rows between the various SELECT statements.
The following is an example of the SQL UNION query that returns one field from multiple SELECT
statements (and both fields have the same data type):
69 | P a g e
SELECT supplier_id
FROM suppliers
UNION
SELECT supplier_id
FROM orders;
Join
SQL JOINS are used in a SQL query to retrieve data from multiple tables. A SQL JOIN is performed
whenever two or more tables are joined in a SQL statement. There are 4 different types of SQL joins:
SUMMARY
1. Database Management System or DBMS in short, refers to the technology of storing and
retrieving user’s data with utmost efficiency along with safety and security features.
2. Database is collection of data, which is related by some aspect. Data is collection of facts and
figures which can be processed to produce information.
3. DBMS is used by various users for various purposes. Some may involve in retrieving data and
some may involve in backing it up.
4. Administrators: A bunch of users maintain the DBMS and are responsible for administrating
the database. They are responsible to look after its usage and by whom it should be used.
5. Designer: This is the group of people who actually works on designing part of database. The
actual database is started with requirement analysis followed by a good designing process.
6. End Users: This group contains the persons who actually take advantage of database system.
End users can be just viewers who pay attention to the logs or market rates or end users can
be as sophisticated as business analysts who take the most of it.
7. A relational database will allow you to store data organized such that you can store your
information in tables, organized by rows (records) and columns (fields) which you can then
store and access as required.
70 | P a g e
8. Data model tells how the logical structure of a database is modeled. Data Models are
fundamental entities to introduce abstraction in DBMS.
9. The hierarchical data model organizes data in a tree structure.
10. Some data were more naturally modeled with more than one parent per child. Therefore, the
network model permitted the modeling of many-to-many relationships in data.
11. The most popular data model in DBMS is Relational Model. It is more scientific model then
others. This model is based on first-order predicate logic and defines table as an n-any
relation.
12. A table has rows and columns, where rows represent records and columns represents the
attributes
13. Tuple: A single row of a table, which contains a single record for that relation, is called a tuple.
14. Relation instance is a finite set of tuples in the relational database system represents relation
instance.
15. Relation schema describes the relation name (table name), attributes and their names.
16. Data Definition Language (DDL) statements are used to define the database structure.
17. The CREATE DATABASE statement is used to create a database.
21. The GROUP BY statement is used in conjunction with the aggregate functions to group the
result-set by one or more columns.
22. The ORDER BY keyword is used to sort the result-set by one or more columns.
23. The SQL UNION query is a SQL query to combine the result sets of 2 or more SQL SELECT
statements. It removes duplicate rows between the various SELECT statements.
24. SQL JOINS are used in a SQL query to retrieve data from multiple tables. A SQL JOIN is
performed whenever two or more tables are joined in a SQL statement.
EXERCISES
71 | P a g e
Lesson-6
NETWORK SAFETY OF
COMPUTER SYSTEM
You will learn
Network Safety and Security
Network Safety Network Safety
Social Networking Ethics
Network safety consists of the provisions and policies adopted by Network Security Tools And
Services
a network administrator to prevent and monitor unauthorized
Tools
access, misuse, modification, or denial of a computer network LAN Management
and network-accessible resources. Network security involves the MAN Management
WAN Management
authorization of access to data in a network, which is controlled
PAN Management
by the network administrator. Users choose or are assigned an ID VOIP
and password or other authenticating information that allows them Cyber Security
need
74 | P a g e
Objectives
Social Networking Various
Practices
access to information and programs within their authority.
This concise, high-end guide shows experienced administrators how to customize and extend popular
open source security tools such as port scanners, packet injectors, network sniffers, and web
assessment tools. Network security tools are used to lock down the network for safety.
LAN Management
A local area network (LAN) is a computer network that interconnects computers in a limited area such
defining characteristics of LANs, in contrast to wide area network (WANs), include their smaller
geographic area.Token ring and other technology standards have been used in the past, but
Ethernet over twisted pair cabling and Wi- Fi are the two most common technologies currently used to
build LANs.as a home, school, computer laboratory, or office building using network media.
MAN Management
75 | P a g e
determined by local municipal corporations; the larger the city, the bigger the MAN, the smaller a
metro city, smaller the MAN
WAN Management
A wide area network (WAN) is a network that covers a broad area (i.e., any telecommunication
network that links across metropolitan, regional, or national boundaries) using private
or public network transports. Business and government entities utilize WANs to relay data among
employees, clients, buyers, and suppliers from various geographical locations. In essence, this mode
of telecommunication allows a business to effectively carry out its daily function regardless of
location. The Internet can be considered a WAN as well, and is used by businesses, governments,
organizations, and individuals.
PAN management
phones. When files are transferred from a PC to an MP3 player, a PAN is set up between the two.
There can also be multiple devices in PAN. A PAN can be set up using guided media (USB cable) or
unguided media (Bluetooth, Infrared).
VOIP
Voice over Internet Protocol (VoIP) is a methodology and group of technologies for the delivery
of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the
Internet. Early providers of voice over IP services offered business models and technical solutions
that mirrored the architecture of the legacy telephone network. Second-generation providers, such as
Skype have built closed networks for private user bases, offering the benefit of free calls and
convenience while potentially charging for access to other communication networks.
Cyber Security
Cyber security is information security applied to computers and computer network. The field covers all
the processes and mechanisms by which computer-based equipment, information and services are
protected from unintended or unauthorized access, change or destruction. Cyber security also
includes protection from unplanned events and natural disasters.
Need: Governments, military, corporations, financial institutions, hospitals and other businesses
collect, process and store confidential information on computers and transmit that data across
networks to other computers. With the growing volume and sophistication of cyber-attacks, ongoing
76 | P a g e
attention is required to protect sensitive business and personal information, as well as safeguard
national security. So to secure all crucial and confidential data cyber security is required.
Objectives Cyber Security’s main purpose is to secure the data and maintain confidentiality of any
information stored in computer. It is use to secures the network, as well as protect and oversee
operations being done.
Cloud Computing
Cloud computing enables companies to consume compute resources as a utility just like electricity --
rather than having to build and maintain computing infrastructures in-house.
Cloud computing promises several attractive benefits for businesses and end users including:
77 | P a g e
• Self-service provisioning: End users can spin up computing resources for almost any type of
workload on-demand.
• Elasticity: Companies can scale up as computing needs increase and then scale down again
as demands decrease.
• Pay per use: Computing resources are measured at a granular level, allowing users to pay
only for the resources and workloads they use.
SUMMARY
1. Network safety consists of the provisions and policies adopted by a network administrator to
prevent and monitor unauthorized access, misuse, modification, or denial of a computer
network and network-accessible resources.
2. A local area network (LAN) is a computer network that interconnects computers in a limited
area such defining characteristics of LANs.
78 | P a g e
7. Cyber security is information security applied to computers and computer network.
8. Mobile computing is human–computer interaction by which a computer is expected to be transported
during normal usage.
9. Cloud computing enables companies to consume compute resources as a utility just like
electricity -- rather than having to build and maintain computing infrastructures in-house.
EXERCISES
Example:
<script type="text/javascript">
<!--
var name = "Ali";
var money;
money = 2000.50;
//-->
</script>
The scope of a variable is the region of your program in which it is defined. JavaScript variable will
have only two scopes.
• Global Variables: A global variable has global scope which means it is defined everywhere in
your JavaScript code.
• Local Variables: A local variable will be visible only within a function where it is defined.
Function parameters are always local to that function.
<script type="text/javascript">
<!--
var myVar = "global"; // Declare a global variable
function checkscope( ) {
var myVar = "local"; // Declare a local variable
document.write(myVar);
}
36 |
Page
//-->
</script>
• You should not use any of the JavaScript reserved keyword as variable name.
• JavaScript variable names should not start with a numeral (0-9). They must begin with a letter
or the underscore character.
• JavaScript variable names are case sensitive.
The following are reserved words in JavaScript. They cannot be used as JavaScript variables,
functions, methods, loop labels, or any object names.
37 |
Page
abstract else instanceof switch
boolean enum int synchronized
break export interface this
byte extends long throw
case false native throws
catch final new transient
char finally null true
class float package try
const for private typeof
continue function protected var
debugger goto public void
default if return volatile
delete implements short while
do import static with
double in super
38 |
Page
+ Adds two operands A + B will give 30
&& Called Logical AND operator. If both the operands are (A && B) is true.
non zero then then condition becomes true.
! Called Logical NOT Operator. Use to reverses the !(A && B) is false.
logical state of its operand. If a condition is true then
Logical NOT operator will make false.
39 |
Page
Operator Description Example
== Checks if the value of two operands are equal or not, if (A == B) is not true.
yes then condition becomes true.
> Checks if the value of left operand is greater than the (A > B) is not true.
value of right operand, if yes then condition becomes
true.
< Checks if the value of left operand is less than the value (A < B) is true.
of right operand, if yes then condition becomes true.
>= Checks if the value of left operand is greater than or (A >= B) is not true.
equal to the value of right operand, if yes then condition
becomes true.
<= Checks if the value of left operand is less than or equal to (A <= B) is true.
the value of right operand, if yes then condition becomes
true.
40 |
Page
The Assignment Operators:
41 |
Page
• if statement
• if...else statement
• if...else if... statement.
if statement:
The if statement allows JavaScript to make decisions and execute statements conditionally.
Syntax:
if (expression){
Statement(s) to be executed if expression is true
}
Example:
<script type="text/javascript">
var age = 20;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}
</script>
if...else statement:
The if...else statement is the next form of control statement that allows JavaScript to execute
statements in more controlled way i.e to choose from given options.
Syntax:
if (expression){
Statement(s) to be executed if expression is true
}else{
Statement(s) to be executed if expression is false
}
42 |
Page
Example:
<script type="text/javascript">
var age = 15;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}else{
document.write("<b>Does not qualify for driving</b>");
}
</script>
if...else if... statement: The if...else if... statement allows JavaScript to make correct decision out of
several conditions.
Syntax:
if (expression 1){
Statement(s) to be executed if expression 1 is true
}else if (expression 2){
Statement(s) to be executed if expression 2 is true
}else if (expression 3){
Statement(s) to be executed if expression 3 is true
}else{
Statement(s) to be executed if no expression is true
}
Example:
<script type="text/javascript">
var book = "maths";
if( book == "history" ){
document.write("<b>History Book</b>");
}else if( book == "maths" ){
document.write("<b>Maths Book</b>");
}else if( book == "economics" ){
document.write("<b>Economics Book</b>");
}else{
document.write("<b>Unknown Book</b>");
}
43 |
Page
</script>
Maths Book
Switch Case: You can use multiple if...else if statements, to perform a multiway branch. However,
this is not always the best solution, especially when all of the branches depend on the value of a
single variable.
Syntax:The basic syntax of the switch statement is to give an expression to evaluate and several
different statements to execute based on the value of the
expression. The interpreter checks each case against the switch (expression)
value of the expression until a match is found. If nothing {
matches, a default condition will be used. case condition 1: statement(s)
The break statements indicate to the interpreter the break;
end of that particular case. If they were omitted, the case condition 2: statement(s)
<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
44 |
Page
switch (grade)
{
case 'A': document.write("Good job<br />");
break;
<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
switch (grade)
{
case 'A': document.write("Good job<br />");
case 'B': document.write("Pretty good<br />");
case 'C': document.write("Passed<br />");
case 'D': document.write("Not so good<br />");
case 'F': document.write("Failed<br />");
default: document.write("Unknown grade<br />")
}
document.write("Exiting switch block");
</script>
45 |
Page
This will produce following result:
Iteration – Loops
A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.
This not only saves you the time and trouble of repeatedly typing the same lines of code, but also
avoids typing errors in the repeated lines.
JavaScript allows you to use the for, while, and do while loops.
JavaScript Code Here The JavaScript code for the loop will be inside the brackets here
1. Initialization: Here we initialize our counter to a starting value. The initialization statement is
executed before the loop begins.
2. Test condition: If condition is true then code given inside the loop will be executed otherwise
loop will come out.
46 |
Page
3. Iteration statement: The iteration statement where you can increase or decrease your
counter.
<script type="text/javascript">
<!--
for (var count=1;count<6;count+=1) {
document.write("I am part of a loop!<br />");
}
//-->
</script>
I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!
While loop:
syntax : initialization;
while( condition )
Update expression;
Example:
count++;
Program to print
5 numbers using
a <script type="text/javascript"> basic while
var count = 1;
loop:
document.write("Starting Loop" + "<br />");
while (count <= 5)
{
document.write("Number : " + count + "<br />");
count++;
}
document.write("Loop stopped!");
</script>
Starting Loop
Number : 1
Number : 2
Number : 3
Number : 4
Number : 5
Loop stopped!
Window Object
The window object represents an open window in a browser.
If a document contain frames (<iframe> tags), the browser creates one window object for the HTML
document, and one additional window object for each frame.
48 |
Page
Some common Window Object Methods:
confirm() Displays a dialog box with a message and an OK and a Cancel button
getSelection() Returns a Selection object representing the range of text selected by the user
prompt() Displays a dialog box that prompts the visitor for input
JavaScript supports three important types of dialog boxes. These dialog boxes can be used to raise
and alert, or to get confirmation on any input or to have a kind of input from the users.
An alert dialog box is mostly used to give a warning message to the users.
<html>
<head>
<script type="text/javascript">
<!--
function Warn()
49 |
Page
{
alert("This is a warning message!");
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="Warn();" />
</form>
</body>
</html>
Nonetheless, an alert box can still be used for friendlier messages. Alert box gives only one button
"OK" to select and proceed.
A confirmation dialog box is mostly used to take user's consent on any option. It displays a dialog box
with two buttons: OK and Cancel.
If the user clicks on OK button the window method confirm() will return true. If the user clicks on the
Cancel button confirm() returns false. You can use confirmation dialog box as follows:
50 |
Page
<html>
<head>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
alert("User wants to continue!");
return true;
}else{
alert("User does not want to continue!");
return false;
}
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getConfirmation();" />
</form>
</body>
</html>
This dialog box is displayed using a method called prompt() which takes two parameters (i) A label
which you want to display in the text box (ii) A default string to display in the text box.
This dialog box with two buttons: OK and Cancel. If the user clicks on OK button the window
method prompt() will return entered value from the text box. If the user clicks on the Cancel button the
window method prompt() returns null.
<html>
<head>
<script type="text/javascript">
function getValue(){
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getValue();" />
</form>
</body>
</html>
On clicking button ‘Click Me’ prompt dialog box will appear on the screen.
52 |
Page
FUNCTIONS –USER DEFINED
A function is a group of reusable code which can be called anywhere in your programme. This
eliminates the need of writing same code again and again. This will help programmers to write
modular code. You can divide your big programme in a number of small and manageable functions.
Function Definition:
The most common way to define a function in JavaScript is by using the function keyword, followed
by a unique function name, a list of parameters (that might be empty), and a statement block
surrounded by curly braces.
The basic syntax is
shown here:
Example:
53 |
Page
<script type="text/javascript">
<!--
function sayHello()
{
alert("Hello there");
}
//-->
</script>
Calling a Function:
To invoke a function , you would simple need to write the name of that function as follows:
<script type="text/javascript">
<!--
sayHello();
//-->
</script>
Function Parameters:
We can pass different parameters while calling a function. These passed parameters can be captured
inside the function and any manipulation can be done over those parameters.
A function can take multiple parameters separated by comma.
Example: Let us do a bit modification in our sayHello function. This time it will take two parameters:
<script type="text/javascript">
<!--
function sayHello(name, age)
{
alert( name + " is " + age + " years old.");
}
//-->
</script>
54 |
Page
Note: We are using + operator to concatenate string and number all together. JavaScript does not
mind in adding numbers into strings.Now we can call this function as follows:
<script type="text/javascript">
<!--
sayHello('Zara', 7 );
//-->
</script>
A JavaScript function can have an optional return statement. This is required if you want to return a
value from a function. This statement should be the last statement in a function.
For example you can pass two numbers in a function and then you can expect from the function to
return their multiplication in your calling program.
Example:
This function takes two parameters and concatenates them and return resultant in the calling
program:
<script type="text/javascript">
<!--
function concatenate(first, last)
{
var full;
<script type="text/javascript">
<!--
var result;
55 |
Page
result = concatenate('Zara', 'Ali');
alert(result );
//-->
</script>
String Object
• Encapsulation . the capability to store related information, whether data or methods, together in
an object
• Aggregation . the capability to store one object inside of another object
• Inheritance . the capability of a class to rely upon another class (or number of classes) for use
of its properties and methods
• Polymorphism . the capability to write one function or method that works in a variety of different
ways
The String object let's you work with a series of characters and wraps Javascript's string primitive
data type with a number of helper methods.
Example:
var guitar_string = new String("Gagan");
OR
String Properties
Property Description
56 |
Page
EXAMPLE:
<body>
<script type="text/javascript">
var myname="John";
</script>
</body>
Result is :
String Methods
Method Description
57 |
Page
specified location through the specified number of
characters.
Example:
Result is : GaganSagan
Here is a list of each method, which returns a copy of the string wrapped inside the appropriate HTML
tag.
Method Description
58 |
Page
blink() Creates a string to blink as if it were in a <blink> tag.
fontsize() Causes a string to be displayed in the specified font size as if it were in a <font
size="size"> tag.
Example:
var text = "I am so mad I am red!";
document.write(text.fontcolor("red"));
This script places the following code into the page source:
<font color="red">I am so mad I am red!</font>
Math Object
The math object provides you properties and methods for mathematical constants and functions.
Syntax
Example:
59 |
Page
var pi_val = Math.PI; // pi_val =3.14159
var sq = Math.SQRT2; // sq = 1.414
Math Properties
Property Description
Math Methods
Method Description
pow() Returns base to the exponent power, that is, base exponent.
Example :
60 |
Page
var num =4;
document .write(“ SQURE ROOT OF NUM = “+ sqrt(num) );
Event
What is an Event?
When the page loads, that is an event. When the user clicks a button, that click, too, is an event.
Another example of events are like pressing any key, closing window, resizing window etc.
This is the most frequently used event type which occurs when a user clicks mouse left button. You
can put your validation, warning etc against this event type.
Example:
<html>
<head>
<script type="text/javascript">
<!--
function sayHello() {
alert("Hello World")
}
//-->
</script>
</head>
<body>
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>
This will produce following result and when you click Hello button then onclick event will occur
which will trigger sayHello() function.
61 |
Page
Another most important event type is on submit. This event occurs when you try to submit a form. So
you can put your form validation against this event type.
Example:
<html>
<head>
<script type="text/javascript">
<!--
function validation() {
all validation goes here
.........
return either true or false
}
//-->
</script>
</head>
<body>
<form method="POST" action="t.cgi" onsubmit="return validate()">
.......
<input type="submit" value="Submit" />
</form>
</body>
</html>
The onmouseover event occurs when you bring your mouse over any element and theonmouseout
occurs when you take your mouse out from that element.
Example: Following example shows how a division reacts when we bring our mouse in that division:
<html>
62 |
Page
<head>
<script type="text/javascript">
<!--
function over() {
alert("Mouse Over");
}
function out() {
alert("Mouse Out");
}
//-->
</script>
</head>
<body>
<div onmouseover="over()" onmouseout="out()">
<h2> This is inside the division </h2>
</div>
</body>
</html>
The standard HTML 4 events are listed here for your reference. Here script indicates a Javascript
function to be executed agains that event.
63 |
Page
over an element
SUMMARY
1. One of the most fundamental characteristics of a programming language is the set of data
types it supports.
2. Variable is the stored memory location that can hold a value in it. Variables are declared with
the var keyword.
3. The scope of a variable is the region of your program in which it is defined. JavaScript variable
have only two scopes: Global and Local Variables
4. Global Variables is a global variable has global scope which means it is defined everywhere
in your JavaScript code.
5. Local Variables is a local variable will be visible only within a function where it is defined.
6. An Operator is a symbol that performs an operation. JavaScript language supports Arithmetic,
Comparison, Logical, Assignment, and Conditional Operators.
7. The if statement allows JavaScript to make decisions and execute statements conditionally.
8. The if...else statement is the next form of control statement that allows JavaScript to execute
statements in more controlled way i.e to choose from given options.
9. if...else if... statement: The if...else if... statement allows JavaScript to make correct decision
out of several conditions.
10. Switch case is one of the alternate of multiple if. Else…if…
11. A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.
12. The window object represents an open window in a browser
13. A confirmation dialog box is mostly used to take user's consent on any option. It displays a
dialog box with two buttons: OK and Cancel.
14. The prompt dialog box is very useful when you want to pop-up a text box to get user input.
Thus it enable you to interact with the user. The user needs to fill in the field and then click OK.
64 |
Page
15. A function is a group of reusable code which can be called anywhere in your programme. This
eliminates the need of writing same code again and again.
16. The math object provides you properties and methods for mathematical constants and
functions
17. An occurance of an activity is called an event.
18. The onmouseover event occurs when you bring your mouse over any element and
theonmouseout occurs when you take your mouse out from that element.
EXERCISES
i. _____________ is the stored memory location that can hold value in it.
ii. _____________ cannot be used as variable.
iii. An __________ is a symbol that performs an operation.
iv. ___________control statement allows JavaScript to execute statement in more
controlled way.
v. ____________is one of the alternate of multiple if….else….if.
vi. The _____________ object represents an open window in a browser.
vii. ____________ is mostly used to give warning message to the users.
viii. ____________ is a group of reusable code which can be called anywhere in your
program.
ix. ___________keyword is used to define function in JavaScript.
x. The _____________object provides you properties and methods for mathematical
constants and functions.
B. State true or false:
i. The onmouseover event occurs when you take out your mouse out from that
element.
ii. An occurrence of an activity is called event.
iii. Pow( ) method returns base to the exponent power.
iv. Encapsulation is the capability of a class to rely upon another class for use of its
properties and methods.
v. JavaScript function can have a optional return statement.
65 |
Page