You are on page 1of 60

EX.

NO: 1

DATE:

FLOW LAYOUT

AIM: To write a java program for implementing flowlayout concept.

ALGORITHM:

1. Start the program.

2. Import the various packages like-awt. * and applet. *

3. Include the comment statement <applet> which contains code = ”classname.class”

and the height and width for the applet window.

4. Inside the class, use the method void init ()

5. Create objects for FlowLayout, Label, TextField and Button.

6. Add all the components to the layout using add () method.

7. Compile the code

8. View it using Applet Viewer.

9. Stop the program.

1
PROGRAM:

// program to demonstrate the flow layout

import java.awt.*;
import java.applet.*;

/*<applet code="flowlayout" height=300 width=300>


</applet>*/

public class flowlayout extends Applet


{
public void init()
{
FlowLayout f1=new FlowLayout(FlowLayout.LEFT);
setLayout(f1);

Label l1=new Label("User Name");


add(l1);

TextField t1=new TextField("Enter the E- Mail ID");


add(t1);

Label l2=new Label("User Password");


add(l2);

TextField t2=new TextField("Enter Password");


add(t2);
t2.setEchoChar('*');

Button b=new Button("Sign In");


add(b);
}
}

2
OUTPUT:

Z:\>javac flowlayout.java
Z:\>appletviewer flowlayout.java

RESULT: Thus the program has been executed successfully.

3
EX.NO: 2

DATE:

BORDER LAYOUT

AIM: To write a java program for implementing border layout concept.

ALGORITHM:

1. Start the program.

2. Import the various packages like-awt.* and applet.*

3. Include the comment statement <applet> which contains code=”classname.class” and the

height and width for the applet window.

4. Inside the class use the method void init()

5. Create objects for BorderLayout and Button

6. Add the components using add() method

7. Compile the code and view it using AppletViewer.

8. Stop the program.

4
PROGRAM:

//program to demonstrate the border layout

import java.applet.*;
import java.awt.*;

/*<applet code=borderlayout height=300 width=300>


</applet>*/

public class borderlayout extends Applet


{
public void init()
{
BorderLayout b=new BorderLayout(10,10);
setBackground(Color.white);
setLayout(b);

Button b1=new Button("Play");


add(b1,BorderLayout.NORTH);

Button b2=new Button("Stop");


add(b2,BorderLayout.SOUTH);

Button b3=new Button("Clip");


add(b3,BorderLayout.EAST);

Button b4=new Button("Edit");


add(b4,BorderLayout.WEST);

TextArea ta=new TextArea(20,20);


ta.setBackground(Color.white);
add(ta,BorderLayout.CENTER);
}
}

5
OUTPUT:

Z:\>javac borderlayout.java

Z:\>appletviewer borderlayout.java

RESULT: Thus the program has been executed successfully.

6
EX.NO: 3

DATE:

GRID LAYOUT

AIM: To write a java program for implementing grid layout concept.

ALGORITHM:

1. Start the program.

2. Import the various packages like-awt.* and applet.*

3. Include the comment statement <applet> which contains code=”classname.class” and the

height and width for the applet window.

4. Inside the class use the method void init()

5. Create objects for GridLayout,Button .

6. Add the components to the Applet

7. Compile the code and view it using Applet Viewer.

8. Stop the program.

PROGRAM:

7
//program to demonstrate the grid layout

import java.applet.*;
import java.awt.*;

/*<applet code=gridlayout height=300 width=300>


</applet>*/

public class gridlayout extends Applet


{
public void init()
{
GridLayout g=new GridLayout(3,4,2,2);
setLayout(g);
Button b[];

for(int i=0;i<12;i++)
{
add(new Button(""+i));
}
}
}

8
OUTPUT:

Z:\>javac gridlayout.java

Z:\>appletviewer gridlayout.java

RESULT: Thus the program has been executed successfully.

EX.NO: 4

9
DATE:

GRIDBAG LAYOUT

AIM: To write a java program for implementing gridbag layout concept.

ALGORITHM:

1. Start the program.

2. Import the various packages like-awt.* and applet.*

3. Include the comment statement <applet> which contains code=”classname.class” and the

height and width for the applet window.

4. Inside the class use the method void init()

5. Create objects for GridBagLayout,GridBagConstraints,Label,buttons.

6. Add all the components using add() method.

7. Set the coordinates using gridx and gridy and SetConstraints.

8. Compile the code and view it using AppletViewer.

9. Stop the program.

PROGRAM:

10
// program to demonstrate the gridbag layout

import java.awt.*;
import java.applet.*;
/*<applet code=gridbag height=300 width=300>
</applet>*/
public class gridbag extends Applet
{
public void init()
{
GridBagLayout gb =new GridBagLayout();
setLayout(gb);
GridBagConstraints gc=new GridBagConstraints();
Label l=new Label("States and Capitals");
gc.fill=GridBagConstraints.BOTH;
gb.setConstraints(l,gc);
add(l);
Label l1=new Label("Tamil Nadu");
add(l1);
Label l2=new Label("Goa");
add(l2);
Button b1=new Button("Chennai");
add(b1);
Button b2=new Button("Panaji");
add(b2);
gc.gridx=0;
gc.gridy=2;
gb.setConstraints(l1,gc);

gc.gridx=1;
gc.gridy=2;
gb.setConstraints(b1,gc);

gc.gridx=0;
gc.gridy=3;
gb.setConstraints(l2,gc);

gc.gridx=1;
gc.gridy=3;
gb.setConstraints(b2,gc);
}
}

OUTPUT:

11
Z:\>javac gridbag.java

Z:\>appletviewer gridbag.java

RESULT: Thus the program has been executed successfully.

EX.NO: 5

12
DATE:

CARD LAYOUT

AIM: To write a java program for implementing card layout concept.

ALGORITHM:

1. Start the program.

2. Import the various packages like-awt.* and applet.*

3. Include the comment statement <applet> which contains code=”classname.class” and the

height and width for the applet window.

4. Inside the class use the method void init()

5. Create objects for CardLayout,Panel,TextField,Checkbox and Button,Label

6. Add all the components to the panel add() method.

7. Add the panel to the applet using add()

8. Compile the code and view it using an AppletViewer.

9. Stop the program.

PROGRAM:

13
//program to demonstrate the card layout

import java.awt.*;
import java.applet.*;

/*<applet code=cardlayout height=300 width=300>


</applet>*/

public class cardlayout extends Applet


{
public void init()
{
CardLayout c=new CardLayout(20,30);
Panel p1=new Panel();

Label l1=new Label("User Name");


p1.add(l1);

TextField t1=new TextField(10);


p1.add(t1);

Label l2=new Label("User Password");


p1.add(l2);

TextField t2=new TextField(10);


t2.setEchoChar('#');
p1.add(t2);

Button b=new Button("Submit");


p1.add(b);

Panel p2=new Panel();


Checkbox a=new Checkbox("New User");
p2.add(a);

add(p1);
add(p2);
}
}

OUTPUT:

14
Z:\>javac cardlayout.java

Z:\>appletviewer cardlayout.java

RESULT: Thus the program has been executed successfully.

EX.NO: 6

15
DATE:
AWT CONTROLS-Choice, Scrollbars

AIM: To demonstrate the Choice, Scrollbars using AWT controls in Java Applets.

ALGORITHM:

1. Create the Choice object using the Choice class.

2. Add the item to the choice using addItem() method.

3. Create the Scrolls bars VERTICAL, HORIZONTAL by specifying in the parameters of the
Scrollbars class.

4. Add the Choice and Scrollsbars to the Applet window.

5. Compile the code.

6. View it using Applet Viewer.

7. Stop the program.

PROGRAM:

16
//To demonstrate the listbox and scrollbars AWT controls

import java.awt.*;
import java.awt.event .*;
import java.applet.*;
/*<applet code=choicelist height=500 width=500>
</applet>*/
public class choicelist extends Applet
{
Scrollbar red,blue,green;
{
Choice ch=new Choice();
ch.addItem("HTML");
ch.addItem("Oracle");
ch.addItem("Java");
ch.addItemListener(new ch1());
add(ch);
}
public void init()
{
List l;
Color c=getBackground();
red=new Scrollbar(Scrollbar.HORIZONTAL,c.getRed(),0,0,255);
blue=new Scrollbar(Scrollbar.HORIZONTAL,c.getBlue(),0,0,255);
green=new Scrollbar(Scrollbar.VERTICAL,c.getGreen(),0,0,255);
red.addAdjustmentListener(new sc());
add(red);
blue.addAdjustmentListener(new sc());
add(blue);
green.addAdjustmentListener(new sc());
add(green);
l=new List();
l.add("CSE");
l.add("ECE");
l.add("EEE");
add(l);
l.addActionListener(new sri());
}
class sri implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
showStatus("You have selected "+e.getActionCommand()+" in SREC");
}
}

class sc implements AdjustmentListener


{

17
public void adjustmentValueChanged(AdjustmentEvent e)
{
int r=red.getValue();
int g=green.getValue();
int b=blue.getValue();
Color c=new Color(r,g,b);
setBackground(c);
repaint();
}
}

class ch1 implements ItemListener


{
public void itemStateChanged(ItemEvent e)
{
String s=(String)e.getItem();
showStatus("you have selected "+s+" module");
}
}
}

OUTPUT:

18
Z:\>javac choicelist.java

Z:\>appletviewer choicelist.java

RESULT: Thus the program has been executed successfully.

EX.NO: 7

19
DATE:

AWT CONTROLS-CHECKBOX, OPTION BUTTONS

AIM: To demonstrate the Checkbox, Option buttons using AWT controls in Java Applets.

ALGORITHM:

1. Create the Checkbox using the Checkbox class.

2. Create the Option button using the CheckboxGroup and Checkbox class.

3. Add the Checkbox and Optionbutton to the Applet window.

4. Compile the code.

5. View it using Applet Viewer.

6. Stop the program.

20
PROGRAM:

//To demonstrate the checkbox, option button AWT control

import java.awt.*;
import java.awt.event .*;
import java.applet.*;

/*<applet code=checkbox height=500 width=500>


</applet>*/

public class checkbox extends Applet


{
Checkbox a;
Checkbox b;
CheckboxGroup cbg;
Checkbox c1;
Checkbox c2;
Checkbox c3;

public void init()


{
a=new Checkbox("hardware",false);
b=new Checkbox("software",false);
cbg=new CheckboxGroup();
c1=new Checkbox("DOS & Windows",cbg, true);
c2=new Checkbox("MS office",cbg, false);
c3=new Checkbox("VB",cbg, false);
{
a.addMouseListener(new a1());
b.addMouseListener(new b1());
add(a);
add(b);
c1.addMouseListener(new cc1());
c2.addMouseListener(new cc2());
c3.addMouseListener(new cc3());
add(c1);
add(c2);
add(c3);
}
}

class a1 extends MouseAdapter


{
public void mouseClicked(MouseEvent e)
{
showStatus("you has selected hardware");
}
}
class b1 extends MouseAdapter

21
{
public void mouseClicked(MouseEvent e)
{
showStatus("you has selected software");
}
}
class cc1 extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
showStatus("you has selected DOS & Windows");
}
}
class cc2 extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
showStatus("you has selected MS office");
}
}
class cc3 extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
showStatus("you has selected VB");
}
}
}

22
OUTPUT:

Z:\>javac checkbox.java

Z:\>appletviewer checkbox.java

RESULT: Thus the program has been executed successfully.

23
EX.NO: 8

DATE:

COLOR PALETTE

AIM: To demonstrate the Text Formatting options of AWT controls in Java Applets

ALGORITHM:

1. Create the TextArea Controls using the TextArea class

2. Create the Array of Buttons Using the Button class

3. Using the ActionListener event handler fire the event for the Button Control

4. Using the setForeground() and setBackground() method modify the Foreground and

Background color of the TextArea, with the object of the color class as its parameter

5. Add the TextArea to the Applet window

6. Compile the code

7. View it using Applet Viewer.

8. Stop the program.

24
PROGRAM:

//Program to demonstrate the Matrix of Colors

import java.io.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.*;

/*<applet code=palette height=300 width=300>


</applet>*/

public class palette extends Applet implements ActionListener


{
Checkbox cf,cb;
TextArea a;
private Color
color[]={Color.red,Color.blue,Color.cyan,Color.white,Color.black,Color.green,Color.gray,Col
or.lightGray,Color.darkGray,Color.yellow,Color.pink,Color.magenta,Color.orange};
Button b[];
Panel p1;

public void init()


{
setLayout(new BorderLayout());
p1=new Panel();
b=new Button[13];
for(int i=0;i<color.length;i++)
{
b[i]=new Button(" ");
b[i].addActionListener(this);
b[i].setBackground(color[i]);
p1.add(b[i]);
}

cb=new Checkbox("Back Ground Color",true);


cf=new Checkbox("Fore Ground Color",true);
p1.add(cb);
p1.add(cf);
p1.setVisible(true);
add(p1,BorderLayout.SOUTH);
a=new TextArea(" ");
add(a,BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e)
{

25
if(cb.getState())
{
for(int i=0;i<color.length;i++)
{
if(e.getSource()==b[i])
a.setBackground(color[i]);
}
}
if(cf.getState())
{
for(int i=0;i<color.length;i++)
{
if(e.getSource()==b[i])
a.setForeground(color[i]);
}
}
}
}

26
OUTPUT:

Z:\>javac palette.java
Z:\>appletviewer palette.java

RESULT: Thus the program has been executed successfully.

27
EX.NO: 9

DATE:

URL

AIM: To write a JAVA program to Set the URL of another server, Download the homepage

of the server and Display the contents of the page.

ALGORITHM:

1. We use two classes called URL and URLConnection.

2. The URL class is used to set the URL of another server.

3. openConnetion() is a method in the URL class and its used to open a connection between

the communicating parites

4. openStream() method is used to get the input stream from the web page.

5. Using FileOutputStream, we put the web page contents into a .html file

6. Then, the methods such as getDate(), getExpires(), getLastModified(), getContentLength()

are accessed using the URLConnection class object.

28
PROGRAM:

//To demonstrate the URL concept of Java.

import java.net.*;
import java.io.*;
import java.util.Date;

class url
{
public static void main(String args[]) throws Exception
{
int c;
URL hp=new URL("http://www.google.com");
URLConnection hpCon=hp.openConnection();
System.out.println("Date:"+new Date(hpCon.getDate()));
System.out.println("Content
type:"+hpCon.getContentType());
System.out.println("Expires:"+hpCon.getContentType());
System.out.println("Last-Modified:"+new Date(hpCon.getLastModified()));
int len=hpCon.getContentLength();
System.out.println("Content-Length:"+len);
if(len>0)
{
System.out.println("====Content====");
InputStream input=hpCon.getInputStream();
int i=len;
while(((c=input.read())!=-1)&&(--i>0))
{
System.out.println((char-) c);
}
input.close();
}
else
{
System.out.println("No content available");
}
}
}

29
OUTPUT:

Z:\>javac url.java
Z:\>java url

Date:Thu Jan 01 05:30:00 GMT+05:30 2004


Content-Type:null
Expires:null
Last-Modified:Thu Jan 01 05:30:00 GMT+05:30 2004
Content-Length:-1
No content available

RESULT: Thus the program has been executed successfully.

30
EX.NO: 10

DATE:

CHATTING

AIM: To write a java program for implementing chatting concept by server side.

ALGORITHM:

CLIENT:
1.Start the program.

2.Import the packages java.io. & java.net.

3.Create a class ‘client’.

4.Create a DatagramSocket at the specified port ,for sending & receiving messages.

5.Declare & initialize byte arrays to act as send & receive buffer.

6.Create a BufferedReader stream for getting keyboard input.

7.Create DatagramPacket for sending & receiving packets using respective buffers.

8.Repeat the following steps till message “bye” is recieved.

i) Build a DatagramPacket for the message to be sent.

ii) Send the message to client using the DatagramSocket send() method.

iii) Recieve the DatagramPacket from the client using the receive( ) method.

iv) Display the message.

9.Stop the program.

31
SERVER :

1.Start the program.

2. Import the packages java.io. & java.net.

3.Create a class ‘server’.

4.Create a DatagramSocket at the specified port ,for sending & receiving messages.

5.Declare & initialize byte arrays to act as send & receive buffer.

6.Create a BufferedReader stream for getting keyboard input.

7.Create DatagramPacket for sending & receiving packets using respective buffers.

8.Repeat the following steps till message “bye” is recieved.

i) Recieve the DatagramPacket from the client using the receive( ) method.

ii) Display the message.

iii) Build a DatagramPacket for the message to be sent.

iv) Send the message to client using the DatagramSocket send() method.

9. Stop the program.

32
PROGRAM:

//Client Side Program

import java.net.*;
import java.io.*;
import java.util.*;

public class client


{
public static void main(String s[])throws Exception
{
DataInputStream d=new DataInputStream(System.in);
DatagramSocket datasocket;
DatagramPacket datapacket;
String s2;
datasocket=new DatagramSocket(1313);
byte []buff;
for(;;)
{
datapacket=new DatagramPacket(new byte[1024],1024);
datasocket.receive(datapacket);
String str=new String(datapacket.getData());
System.out.println("Client:\n"+str);
System.out.println("Server:\n");
s2=d.readLine();
buff=s2.getBytes();
datapacket=new
DatagramPacket(buff,buff.length,datapacket.getAddress(),datapacket.getPort());
datasocket.send(datapacket);

}
}
}

//Server Side Program

import java.net.*;
import java.io.*;
import java.util.*;

public class server


{
public static void main(String s[])throws Exception
{
DataInputStream d=new DataInputStream(System.in);
DatagramSocket datasocket;

33
DatagramPacket datapacket;
String s2;
datasocket=new DatagramSocket(1313);
byte []buff;
for(;;)
{
datapacket=new DatagramPacket(new byte[1024],1024);
datasocket.receive(datapacket);
String str=new String(datapacket.getData());
System.out.println("Client:\n"+str);
System.out.println("Server:\n");
s2=d.readLine();
buff=s2.getBytes();
datapacket=new
DatagramPacket(buff,buff.length,datapacket.getAddress(),datapacket.getPort());
datasocket.send(datapacket);

}
}
}

OUTPUT:

Server Client

Z:\>javac server.java Z:\>javac client.java


Z:\>java server Z:\>java client

Client: hai
Server: how are you?
Client: stop

RESULT: Thus the program for chatting has been executed successfully

34
EX.NO: 11

DATE:
SERVLETS

AIM : To write a program in JAVA to demonstrate the servlet.

ALGORITHM:

1. Identify the classes to be used. A class name odbc that extends from HttpServlet class

name needs to be coded

2. Identify the method to be used.The doGet() method need to be coded to receive

information from the browser, whenever a client browser makes a request for the HTML

page.

3. Generate the source and compile it.

4. Deploy the servlet, then execute the servlet.

*Open the browser and type

http://127.0.0.1:8080/java/odbc

127.0.0.1  Address of the host

8080  is the port number through which the J2SP server

accept the request.

Odbc  Name of the web content for this application name

35
PROGRAM:

//To demonstrate servlet concept


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;

public class odbc extends HttpServlet


{
PrintWriter pw;
Connection cn;
Statement st;
ResultSet rs;
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException,IOException
{
int no;
res.setContentType("text.html");
pw=res.getwriter();
no=Integer.parseInt(req.getParameter("t1").trim());

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}

try
{
cn=DriverManager.getConnection("Jdbc:Odbc:ex10","","");
st=cn.createStatement();
rs=st.executeQuery("select * from MARKLIST where regno="+no);
pw.println("<html><title>JDBC</title>");
pw.println("<body><table cellpadding=2 cellspacing=2
border=1><th>no</th><th>name</th>");
while(rs.next())
{
pw.println("<tr>");
pw.println("<td align=center>");
pw.println(rs.getInt(1));
pw.println("<td align=center>");
pw.println(rs.getString(2));
pw.println("</td>");
}
pw.println("</table></body></html>");

36
}
catch(SQLException e2)
{
System.out.println(e2);
}
}
}

OUTPUT:

RESULT: Thus the program has been executed successfully.

37
EX.NO: 12

DATE: 30-08-07

TEXT FORMATTING

AIM: To demonstrate the Text Formatting options of AWT controls in Java Applets

ALGORITHM:

1. Create the TextArea,Choice Controls using the TextArea ,Choice class respectively

2. Using the ItemListener event handler fire the event for the Choice Control

3. Using the Font class modify the Font ,Font Type, Font Size.

4. Add the TextArea to the Applet window

5. Compile the code

6. View it using Applet Viewer.

7. Stop the program.

38
PROGRAM:

//To Demonstrate the Text Formatting such as Font face, size, type

import java.io.*;
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.awt.event.*;

/*<applet code=textformat.class width=500 height=500></applet>*/

public class menu extends Applet


{
String d;
private String fontsname[]={"TimesRoman","Courier","Helvetica"};
private int typename[]={1,2,3,0};
private String size[]={"10","12","15","18","20","25"};
private String type[]={"Bold","Italic","BoldItalic","Plain"};
TextArea ta;
public menu()
{
FlowLayout f1=new FlowLayout();
setLayout(f1);
Choice cf=new Choice();
cf.addItemListener(new fontmenu());

Choice cs=new Choice();


cs.addItemListener(new sizemenu());

Choice ct=new Choice();


ct.addItemListener(new stylemenu());

for(int i=0;i<3;i++)
{
cf.addItem(fontsname[i]);
cs.addItem(size[i]);
ct.addItem(type[i]);
}
add(cf);
add(cs);
add(ct);
ta=new TextArea(" ",120,80);
add(ta);
}
class fontmenu implements ItemListener
{
public void itemStateChanged(ItemEvent e)
{
for(int i=0;i<fontsname.length; i++)

39
{
if((String)e.getItem()==fontsname[i])
{
d=fontsname[i];
ta.setFont(new Font(fontsname[i],Font.PLAIN,12));
break;
}
}
}
}

class stylemenu implements ItemListener


{

public void itemStateChanged(ItemEvent e)


{
for(int i=0;i<type.length; i++)
{
if((String)e.getItem()==type[i])
{
ta.setFont(new Font(d,typename[i],12));
break;
}
}
}
}

class sizemenu implements ItemListener


{
public void itemStateChanged(ItemEvent e)
{
for(int i=0;i<size.length; i++)
{
if((String)e.getItem()==size[i])
{
ta.setFont(new Font(d,Font.PLAIN,Integer.parseInt(size[i])));
break;
}
}
}
}
}

40
OUTPUT:

Z:\>javac textformat.java
Z:\>appletviewer textformat.java

RESULT: Thus the program has been executed successfully.

41
EX.NO: 13

DATE: 06-09-07

COLLEGE INFORMATION

AIM: To write a program in HTML to publish the college information

ALGORITHM :

1. Create a home page for the college details

2. In that give various information about the college (Department Details)

3. By clicking over the departments move to another page

4. Set an interlink to visit the home page

42
PROGRAM:

//Program for showing the college information.

<html>
<head>
<title>COLLEGE INFORMATION</title>
</head>
<body bgcolor=yellow>
<A NAME="HOME"></A>
<h1 align=center><u>SRI RAM ENGINEERING COLLEGE</u></h1>
<CENTER><H3>PERUMALPATTU VILLAGE,VEPPAMPATTU
R.S,<BR>THIRUVALLUR TK & Dt-602 024.<BR>(NEAR
CHENNAI)</H3></CENTER>
<h3>COURSES OFFERED
<A HREF="#CS"><H4>1.COMPUTER SCIENCE</H4></A>
<A HREF="#IT"><H4>2.INFORMATION TECHNOLOGY</H4></A>
<A HREF="#EC"><H4>3.ELECTRONICS AND COMMUNICATION</H4></A>
<A HREF="#EE"><H4>4.ELECTRICAL AND ELECTRONICS</H4></A>
<A HREF="#MECH"><H4>5.MECHANICAL</H4></A>
<A HREF="#AUTO"><H4>6.AUTOMOBILE</H4></A>
<A HREF="#CHE"><H4>7.CHEMICAL</H4></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="CS"><H3 ALIGN=CENTER><BR><B><U>COMPUTER SCIENCE AND


ENGINEERING</U></B></H3></A>
<BR>STAFF MEMBERS &nbsp; : 8
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 60
<BR>SECOND YEAR &nbsp; : 70
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 80
<BR>FOURTH YEAR &nbsp; : 98
<BR><BR><BR><BR>
<a href="#home"><Center>CLICK HERE TO HOME</Center></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="IT"><h3 align=center><b><u>INFORMATION


TECHNOLOGY</u></b></center></h3></A><BR>
<BR>STAFF MEMBERS &nbsp; : 8
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 50
<BR>SECOND YEAR &nbsp; : 65
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 70
<BR>FOURTH YEAR &nbsp; : 90
<BR><BR><BR><BR>
<a href="#home"><center>CLICK HERE TO HOME</center></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="EC"><h3 align=center><b><u>ELECTRONICS AND

43
COMMUNICATION</u></b></h3></A><BR>
<BR>STAFF MEMBERS &nbsp; : 15
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 90
<BR>SECOND YEAR &nbsp; : 100
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 110
<BR>FOURTH YEAR &nbsp; : 120
<BR><BR><BR><BR>
<a href="#home"><center>CLICK HERE TO HOME</center></A>
<BR><br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="EE"><h3 align=center><b><u>ELECTRICAL AND


ELECTRONICS</u></b></h3></A><BR>
<BR>STAFF MEMBERS &nbsp; : 12
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 40
<BR>SECOND YEAR &nbsp; : 58
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 60
<BR>FOURTH YEAR &nbsp; : 60
<BR><BR><BR><BR>
<a href="#home"><Center>CLICK HERE TO HOME</Center></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="MECH"><h3 align=center><b><u>MECHANICAL</u></b></h3></A><BR>


<BR>STAFF MEMBERS &nbsp; : 10
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 60
<BR>SECOND YEAR &nbsp; : 60
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 60
<BR>FOURTH YEAR &nbsp; : 60
<BR><BR><BR><BR>
<a href="#home"><Center>CLICK HERE TO HOME</Center></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="AUTO"><h3 align=center><b><u>AUTOMOBLE</u></b></h3></A><BR>


<BR>STAFF MEMBERS &nbsp; : 9
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 35
<BR>SECOND YEAR &nbsp; : 50
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 55
<BR>FOURTH YEAR &nbsp; : 60
<BR><BR><BR><BR>
<a href="#home"><Center>CLICK HERE TO HOME</Center></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

<A NAME="CHE"><h3 align=center><b><u>CHEMICAL</u></b></h3></A><BR>


<BR>STAFF MEMBERS &nbsp; : 8
<BR><BR><U>STUDENTS STRENGTH</U>
<BR><BR>FIRST YEAR&nbsp; &nbsp; &nbsp; &nbsp; : 40

44
<BR>SECOND YEAR &nbsp; : 50
<BR>THIRD YEAR &nbsp; &nbsp; &nbsp; : 55
<BR>FOURTH YEAR &nbsp; : 60
<BR><BR><BR><BR>
<a href="#home"><Center>CLICK HERE TO HOME<Center></A>
<br><br><br><br><br><br><br><br><br><br><br><br>

</body>
</html>

OUTPUT:

Z:\>college.html

45
46
47
48
RESULT: Thus the program has been executed successfully.

49
EX.NO: 14

DATE: 13-09-07

AREA LINK

AIM: To write a program in HTML to demonstrate the use of AREA LINK concept.

ALGORITHM :

1. Create an html page to load the India map.

2. Create four hot spots using coordinates in four major cities.

3. Give area link to those four major cities.

4. If any area is clicked then that area information should be shown.

5. From this page give link to home page.

50
PROGRAM:

INDIA.HTML:

<HTML>
<HEAD>
<TITLE>INFORMATION</TITLE>
</HEAD>
<BODY>
<P><map NAME="MAP">
<AREA HREF="FILE:Z:/sem7web/MAPS/DELHI.HTML" SHAPE="RECT"
COORDS="120,113,125,117">
<AREA HREF="FILE:Z:/sem7web/MAPS/KOLKATTA.HTML" SHAPE="RECT"
COORDS="249,189,256,195">
<AREA HREF="FILE:Z:/sem7web/MAPS/MUMBAI.HTML" SHAPE="RECT"
COORDS="71,233,77,240">
<AREA HREF="FILE:Z:/sem7web/MAPS/CHENNAI.HTML" SHAPE="RECT"
COORDS="149,313,157,320">
<IMG BORDER="0" SRC="FILE:Z:/sem7web/MAPS/MAP4.BMP" USEMAP="#MAP"
WIDTH="371" HEIGHT="408"></P>
</BODY>
</HTML>

DELHI.HTML:

<HTML>
<HEAD>
<TITLE>NEW DELHI</TITLE>
</HEAD>
<BODY>
<H1>NEW DELHI</H1>
<H3><PRE>NEW DELHI IS THE CAPITAL OF INDIA

PARLIMENT HOUSE IS SITUATED HERE

NEW DELHI

NEW DELHI
NEW DELHI
</PRE>
<A HREF="FILE:Z:/sem7web/MAPS/INDIA.HTML">CLICK HERE TO HOME PAGE
</H3>
</BODY>
</HTML>

51
KOLKATTA.HTML:

<HTML>
<HEAD>
<TITLE>KOLKATTA</TITLE>
</HEAD>
<BODY>
<H1>KOLKATTA</H1>
<H3><PRE>KOLKATTA IS THE IMPORTANT CITY

KOLKATTA

KOLKATTA
KOLKATTA
</PRE>
<A HREF="FILE:Z:/sem7web/MAPS/INDIA.HTML">CLICK HERE TO HOME PAGE
</H3>
</BODY>
</HTML>

MUMBAI.HTML:

<HTML>
<HEAD>
<TITLE>CHENNAI</TITLE>
</HEAD>
<BODY>
<H1>MUMBAI</H1>
<H3><PRE>MUMBAI IS THE IMPORTANT CITY

MUMBAI
MUMBAI
MUMBAI
</PRE>
<A HREF="FILE:Z:/sem7web/MAPS/INDIA.HTML" link="blue" alink="red"
vlink="cyan">CLICK HERE TO HOME PAGE
</H3>
</BODY>
</HTML>

52
CHENNAI.HTML:

<HTML>
<HEAD>
<TITLE>CHENNAI</TITLE>
</HEAD>
<BODY>
<H1>CHENNAI</H1>
<H3><PRE>CHENNAI IS THE IMPORTANT CITY

CHENNAI
CHENNAI
CHENNAI
</PRE>
<A HREF="FILE:Z:/sem7web/MAPS/INDIA.HTML">CLICK HERE TO HOME PAGE
</H3>
</BODY>
</HTML>

53
OUTPUT:

54
55
RESULT: Thus the program has been executed successfully.

56
EX.NO: 15

DATE:

CASCADING STYLE SHEET

AIM: To create a webpage using Casecading stylesheet embedded and inline style sheet.

ALGORITHM:

1. Design a web page containing college information.

2. For an Embedded style sheet the text is formatted by importing the format specified in

style tag.

3. For an linked style sheet the text is formatted by importing the format specified in different

file.

4. For an Inline style sheet the text is formatted by using the style specified in each and every

tag.

5. The web page is displayed in a browser.

57
PROGRAM:

EMBEDDED

<html>
<head>
<title>stylesheet</title>
</head>
<style>
body
{
background:white;
margin-left:1 in;
margin-right:1.5in;
}
H1
{
font-size:16pt;
color:green;
font-family:verdana;
text-align:center;
}
</style>
</head>
<body>
<p>Hi!Hello<br>SRI RAM Engg College.The college has a good infrastructure and campus
</p>
<h1>THIS IS H1</h1>
</body>
</html>

EXTERNAL

<html>
<head>
<link rel="stylesheet" href="mystyle.css" type="text/css"></link>
</head>
<body>
Hi there!<p><br>SRI RAM college has seperate labs for each department and all labs are
available to the students till 8.30 pm.the college also encourages the students to excel in extra
curicular activities and other cultural activities.
</p>
</body>
</html>

MYSTYLE.CSS
Body
{
font-size:12pt;

58
font-family:arial;
color:brown;
background:white;
}
p
{
font-size:10pt;
font-family:verdana;
color:blue;
text-indent:0.5in;
margin-left:50px;
margin-right:50px;
}

INLINE

<html>
<head>
<style>
.tech
{
font-weight:bold;
color:blue;
}
</style>
</head>
<body>
<p class ="tech">Hi this is class style sheet<br> This is SRI RAM engineering college
</p>
</body>
</html>

59
OUTPUT:

EMBEDDED OUTPUT:

Hi!Hello
SRI RAM Engg College.The college has a good infrastructure and campus

THIS IS H1
EXTERNAL OUTPUT:

Hi there!

SRI RAM college has seperate labs for each department and all labs are
available to the students till 8.30 pm.the college also encourages the
students to excel in extra curicular activities and other cultural activities.

INLINE OUTPUT:

Hi this is class style sheet


This is SRI RAM engineering college

RESULT: Thus the program has been executed successfully.

60

You might also like