main html project

35
WEB DESIGNING TABLE OF CONTENTS S.NO. TOPICS PAGE NO. REMARKS 1 Create HTML Web Page 2 2 Create Formatted Text 3-7 3 Ordered List and Unordered List 7-9 4 Insert Graphics Image 10 5 Insert Table 11-13 6 Simple Text Field 14 7 Create Password Field 15 8 Create Radio Button 16 9 Create Check Button 17 10 Create Submit Button 18 11 Create Drop-Down Button 19 12 Create Text area 20 13 Create Button 21 14 Create Registration Form 22-25 15 Create Variable using JavaScript 26 16 Create array of Size 10 27 17 Open a window 28 18 Close a window 29 19 Validate the user login 30-32 20 Create Math Object 33-34 21 Print the current date 35 BASIC INFORMATION ABOUT HTML Page | 1

Upload: puneet-gupta

Post on 10-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 1/35

WEB DESIGNING

TABLE OF CONTENTS

S.NO. TOPICS PAGE NO. REMARKS

1 Create HTML Web Page 2

2 Create Formatted Text 3-7

3 Ordered List and Unordered List 7-9

4 Insert Graphics Image 10

5 Insert Table 11-13

6 Simple Text Field 14

7 Create Password Field 15

8 Create Radio Button 16

9 Create Check Button 17

10 Create Submit Button 18

11 Create Drop-Down Button 19

12 Create Text area 20

13 Create Button 21

14 Create Registration Form 22-25

15 Create Variable using JavaScript 26

16 Create array of Size 10 27

17 Open a window 28

18 Close a window 29

19 Validate the user login 30-32

20 Create Math Object 33-34

21 Print the current date 35

BASIC INFORMATION ABOUT HTML

Page | 1

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 2/35

WEB DESIGNING

HTML: Hyper Text Markup LANGUAGE: - The Language used to develop

web pages is called Hyper Text Markup Language (HTML). HTML is the

language interpreted by a Browser. Web Pages are also called HTML

documents. HTML is a set a special codes that can be embedded in text to

add formatting and linking information. HTML is specified as TAGS in an HTM

document (i.e. Web page)

HEAD: Information placed in this section is essential to the inner workings of 

the document. It has nothing to do with contents of the document. All

information placed within <HEAD></HEAD> tags is not displayed in the

browser, with the exception of information contained within the

<TITLE></TITLE> tags. The HTML tags used to indicate the start and end of 

the head section are:

<HEAD>

<TITLE>---</TITLE>

</HEAD>

 TITLE: A Web page could have a title that describes what the page is about

without being too wordy. This can be done by using the TITLE tag. Text

included between the <TITLE>---</TITLE> tag shows up in the title bar of the

browser window.

<Html>

<Head>

<Title> CPJ College </title>

</head>

</html>

BODY: The tag is used to indicate the start and end of the main body of textual information are:

<Html>

<Head>

Page | 2

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 3/35

WEB DESIGNING

<Title>CPJ College</title>

</head>

<Body>

Hello Friends

</body>

</html>

EXERCISE-1

WAP to design <HTML> web page?Page | 3

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 4/35

WEB DESIGNING

<Html>

<Head>

<Title> CPJ College </title>

</head>

<Body>

<h4>Web Page</h4>

<table border="4" width="50 %">

<tr align="center">

<td colspan=3>Header</td>

</tr>

<tr align="center">

<td>Left</td>

<td>Body</td>

<td>Right</td>

</tr>

<tr align="center">

<td colspan=3>Footer</td>

</tr>

</table>

</body></html>

EXERCISE-2

WAP to design the formatted the text on the Web page?

(a.) <P> Tag

Page | 4

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 5/35

WEB DESIGNING

(b.) <Pre>

(c.) <em>

(d.) <Base Font>

(e.) <Font>

Sol (a): <html>

<Head>

<Title> Cpj College</title>

</head>

<Body>

<p>All the text is contained by the

Which causes the browser</p><p> to display

Between exactly as it finds it. </p>

</body>

</html>

Sol (b):<Pre>

<Html>

<Head

Page | 5

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 6/35

WEB DESIGNING

<Title> Cpj College </title>

</head>

<Body>

<Pre>

All the text is contained by the

Which causes the browser to display

Between exactly as it finds it.

It also uses font for presentation.

</pre>

</body>

</html>

Sol (c) :< Em>

<Html>

<Head>

<Title> Cpj College</title>

</head>

<Body>Page | 6

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 7/35

WEB DESIGNING

<h4>Emphasized Tag</h4>

<Em>

All the text is contained by the

Which causes the browser.

</em>

</body>

</html>

Sol (d.) <Base Font>

<Html>

<Head>

<Title>CPJ College</title>

<base font color="red" size="5" >

</head>

Page | 7

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 8/35

WEB DESIGNING

<Body>

<h1> This is a header</h1>

</body>

</html>

Sol (e.) <Font>

<Html>

<Head>

<Title>CPJ College</title>

</head>

<Body>

<font size="12" color="red">Cpl college</font>

</body>

Page | 8

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 9/35

WEB DESIGNING

</html>

EXERCISE-3

 

WAP to design the webpage using list?

(a.) Ordered List

(b) Unordered List

Sol (a):

<Html>

<Head>

Page | 9

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 10/35

WEB DESIGNING

<Title> CPJ College </title>

</head>

<Body>

<b>An Ordered List</b><br>

<h4>List of Colleges</h4>

<ol>

<li>CPJ College</li>

<li>IIMT</li>

<li>JSS</li></ol>

</body>

</html>

(b)

<Html>

<Head>

<Title> CPJ College</title>

</head>

<Body>

<b>An Unordered List</b><br>

<h4>List of Colleges</h4>

<ul>

<li>CPJ College</li>

Page | 10

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 11/35

WEB DESIGNING

<li>IIMT</li>

<li>JSS</li>

</ul>

</body>

</html>

EXERCISE-4

WAP to add a graphics image on the Web Page?

Sol:<Html>

<Head>

<Title> CPJ College </title>

</head>

<Body>

<image src="/D: /VIVEK/HQ wallpapers/hin1v.jpg" width="180

height="180">

</body>

</html>

Page | 11

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 12/35

WEB DESIGNING

EXERCISE-5

WAP to design the Web Page using <Table>?

 

Sol:

<Html>

<Head>

<Title> CPJ College </title>

</head>

<body style="background-color: lightgray ;">

Page | 12

Cell1 Cell2Cell3 Cell4

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 13/35

WEB DESIGNING

<b>Design a table</b></br></br>

<table border="5" style="text-align:center" width="50%">

<tr>

<td>cell1</td>

<td>cell2</td>

</tr>

<tr>

<td>cell3</td>

<td>cell4</td>

</tr>

</table>

</body>

</html>

Page | 13

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 14/35

WEB DESIGNING

EXERCISE-6

WAP to create simple text field on an HTML page?

Sol:

<Html>

<Head>

Page | 14

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 15/35

WEB DESIGNING

<Title> Cpj College </title>

</head>

<Body>

Username <input type ="text" name="user">

</body>

</html>

EXERCISE-7

WAP to create password field on an HTML page?

Sol:

<Html>

<Head>

<Title> Cpj College </title>

Page | 15

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 16/35

WEB DESIGNING

</head>

<Body>

Password<input type="password" name="pass">

</body>

</html>

EXERCISE-8

WAP to create radio button on an HTML page?

Sol:

<Html>

<Head>

<Title> Cpj College </title>

</head>

Page | 16

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 17/35

WEB DESIGNING

<Body>

Male <input type ="radio" name="radio">

Female <input type ="radio" name="radio">

</body>

</html>

EXERCISE-9

WAP to create check button on an HTML page?

Sol:

<Html>

<Head>

<Title> Cpj College </title>

</head>

<Body>

Page | 17

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 18/35

WEB DESIGNING

Friends<input type="checkbox" name="a">

Best Friends <input type="checkbox" name="b">

</body>

</html>

EXERCISE-10

WAP to create submit button on an HTML page?

Sol:

<Html>

<Head>

<Title> Cpj College </title>

</head>

<Body>

<input type="submit" name="submit" value="login">

</body>Page | 18

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 19/35

WEB DESIGNING

</html>

EXERCISE-11

WAP to create a simple drop-

down button on an HTMLpage?

Sol:

<Html>

<Head>

<Title> Cpj College </title>

</head>

<Body>

<select name="college">

Page | 19

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 20/35

WEB DESIGNING

<option value="1">CPJCHS</option>

<option value="2">JSS</option>

<option value="3">IITM</option>

</select>

</body>

</html>

EXERCISE-12

WAP to create a text area using JavaScript on an HTML page?

Sol:

<Html>

<Head>

<Title> Cpj College</title>

</head>

<Body>

Address <text area>

< Input Type=”Text Area” name="address" rows="5" cols="10">

</text area>

Page | 20

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 21/35

WEB DESIGNING

</body>

</html>

Q. 13 WAP to create a text area on an HTML page?

Sol:

<Html>

<Head>

<Title> Cpj College</title>

</head>

<Body>

<input type="button" name="submit" value="Cancel">

</body>

</html>

Page | 21

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 22/35

WEB DESIGNING

EXERCISE-14

WAP to create a registration form on an HTML page?

Sol:

<Html>

<Head>

<Title>Registration</title>

</head>

<Body>

<h1>Submit Your Form</h1>

<form name="form1" method="get" action="abc.html">

<table border="1">

<tr>

Page | 22

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 23/35

WEB DESIGNING

<td>First name</td>

<td><input type="text" name="F.name"></td>

</tr>

<tr>

<td>Last name</td>

<td><input type="text" name="L.name"></td>

</tr>

<tr>

<td>Email</td>

<td><input type="text" name="E.mail"></td>

</tr>

<tr>

<td>Address</td>

<td>

<text area rows=5 cols=10 name="address">

</textarea>

</td>

</tr>

<tr>

<td>college</td>

<td><select name="college">

<option value="1">CPJCHS</option>

<option value="2">JSS</option>

Page | 23

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 24/35

WEB DESIGNING

<option value="3">IITM</option>

</select>

</td>

</tr>

<tr>

<td colspan=2 align="center">

<input type="submit" name="submit" value="login">

</td>

</tr>

</table>

</body>

</html>

Page | 24

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 25/35

WEB DESIGNING

Q.15 WAP to create a variable using JavaScript on an HTML page?

Sol:

<Html>

<Head>

Page | 25

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 26/35

WEB DESIGNING

<Title>CPJ College</title>

</head>

<Body>

<h1>Variable is :</h1>

<Script>

var x=2;

document.write(x);

</script>

</body>

</html>

EXERCISE-16

WAP to create an array of size 10 on an HTML page?

<html>

<head>

<title>CPJ College</title>

Page | 26

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 27/35

WEB DESIGNING

</head>

<body>

<script>

var ar=new Array(5);

ar[0]=1;

ar[1]=2;

ar[2]=3;

ar[3]=4;

ar[4]=5;

for(var i=0; i<5; i++)

{

document.write(ar[i]);

document.write("<br>");

}

</script>

</body>

</html>

EXERCISE-17

WAP to open a window using JavaScript on an HTML page?

Sol:

<Html>

<Head>

<Title> CPJ College </title>

Page | 27

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 28/35

WEB DESIGNING

<Script>

Function win open()

{

window.open("abc.html")

}

</script>

</head>

<body>

<input type="button" name="window" value="open" onclick="winopen();">

</body>

</html>

EXERCISE-18

WAP to close a window using JavaScript on an HTML page?

Sol:

<Html>

<Head>

<Title> CPJ College </title>

<Script>

Page | 28

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 29/35

WEB DESIGNING

function winclose()

{

window.close("abc.html")

}

</script>

</head>

<Body>

<input type="button" name="window" value="close" onclick="winclose();">

</body>

</html>

EXERCISE-19

WAP to validate the user login using JavaScript on an HTML page?

Sol:

<Html>

<Head>

<Title>Login</title>

<Script>

Function log()

Page | 29

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 30/35

WEB DESIGNING

{

Alert ("thanku for login");

}

</script>

</head>

<Body>

<h1>Login your Id</h1>

<form name="form1" method="get" action="abc.html">

<table border="1">

<tr>

<td>Name</td>

<td>

<input type="text" name="user">

</td>

</tr>

<tr>

<td>Password</td>

<td>

<input type="password" name="pass">

</td>

</tr>

<tr>

<td align="center" colspan=2>

Page | 30

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 31/35

WEB DESIGNING

<input type="submit" name="sub" value="login” onclick=”log();”>

</td>

</tr>

</table>

</body>

</html>

EXERCISE-20

WAP to create a web page using Math object in JavaScript?

(a.) abs () (b.) Ceil () (c.) pow ()

Sol: (a) abs () – Calculates the absolute value of the number

<Html>

<Head>

<Title> Cpj College </Title>

</Head>

<Body>

Page | 31

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 32/35

WEB DESIGNING

<Script>

{

document.write (Math.abs(-15))

}

</script>

</body>

</html>

(b.) ceil () – Returns the next integer greater than or equal to a number

<Html>

<Head>

<Title> Cpj College </Title>

</Head>

<Body>

<Script>

{

document. Write (Math.ceil (15.45))

}

</script>

Page | 32

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 33/35

WEB DESIGNING

</body>

</html>

(c.) pow () – Calculates the value of one number to the power of a second

number – takes two arguments.

<Html>

<Head>

<Title> Cpj College </Title>

</Head>

<Body>

<Script>

{

Document.write(Math.pow(2,2))

}

</script>

</body>

Page | 33

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 34/35

WEB DESIGNING

</html>

EXERCISE-21

WAP a program to print the current date using JavaScript?

Sol:

<Html>

<Head>

<Title>CPJ College</title>

</head>

<Body>

<Script>

var x=new Date();

document.write(x);

</script>

</body>

Page | 34

8/8/2019 Main HTML Project

http://slidepdf.com/reader/full/main-html-project 35/35

WEB DESIGNING

</html>