html xml applets

34
HTML

Upload: priyanka-haldar

Post on 18-Dec-2015

58 views

Category:

Documents


8 download

DESCRIPTION

A few programs on HTML, XML and Java Applets

TRANSCRIPT

HTML

1. Start your web page with an tagi. Add a headingii. Add a titleiii. Start the sectioniv. Start a new paragraph Create hyperlinks-i. Within the HTML documentii. To another URLiii. To a file that can be rendered in the browser.CODE:

Project List Computer Science Major Project Topics Web based Applications for Insurance Services
Cold Boot Attack
Virtual Class Rooms
Electronic Mail Server
SUDOKU
Bluetooth Hotspot
Result Alert System With E-mail and SMS
Bug Tracking System
Partial Face Recognition Using Core features Of The Face
Face Recognition in e-attendance
Online Examination System
Chat Server
Bluetooth Home Automation
Creepy Crawler System
Back to Top For more details visit http://www.projecttopics.info/ Also see this!

OUTPUT:

2. Start your web page with an tag

i. Add a headingii. Add a titleiii. Start the sectionCreate an unordered list; create an ordered list; use various bullet styles, create nested lists; use the font tag in conjunction with lists; create definition lists; use graphics as bullets.CODE:

Project List LISTS IN HTML

  • This is the first item in unnumbered list.
  • This is the next
  • The third item is itself a list:
    • First item in the nested list.
    • Second; be sure to end both lists!
  1. The first item in numbered list
  2. They are also called ordered list

HTML HyperText Markup Language is a language that defines web pages. SGML Standarised General Markup Language is a class of markup languages like HTML

OUTPUT:

3. Start your web page with an tag

i. Add a headingii. Add a titleiii. Start the section

a) Create a simple table; create borders and adjust border size; adjust table cell spacing; change border color; change table background color

b) Align a new table on html page; perform cell text alignment; create multi column table; display information about your academic qualification into this table.

a. CODE:

HTML Table Cellpadding

Name Salary Priyanka Haldar 40000 Ankita Das 50000

OUTPUT:NameSalary

Priyanka Haldar40000

Ankita Das50000

b. CODE:a

HTML Table Cellpadding

Name 10th % 12th % Graduation % Priyanka Haldar 87.6 70 77

OUTPUT:Name10th %12th %Graduation %

Priyanka Haldar87.67077

4. Start your web page with an tag

i. Add a headingii. Add a titleiii. Add the section

Create a frameset: use frame tags : create vertical(columns) frames; create horizontal(rows) frames; create complex framesets; use the hyperlink tag to target displaying an html page to another frame.

CODE:Frametest.html

Frame Samples

left.html

Frames - Left Left Frame

top.html

Frames - Top

Top Frame

center.html

Frame Samples Center

Center Frame

bottom.html

Frames - Bottom

Bottom Frame

OUTPUT:

5. Start your web page with an tag

i. Add a headingii. Add a titleiii. Start the section

Create a simple HTML form: use the input tag to create a text box, text area box, checkbox, listbox, radio button, password field, popup menu, hidden field. Use submit button. Create an admission form using the above information.

CODE:

ADMISSION FORM

ADMISSION FORM First Name:
Last Name:
Username:
Password:
Address:
Enter your address here...
Date of Birth:
Phone no.:
Gender: Male Female
Qualification: 10th 12th BTech

OUTPUT:

XML

1. Write a XML program that will create an XML document which contains your mailing address.CODE:

]>

My mailing address: [email protected]

email.csslabel{ margin-top: 100px; font-size: 36px; font-weight: bold; vertical-align:baseline; color: #00beeb; text-align: center; display: block;}

address{ font-size: 28px; font-family: Georgia; vertical-align:baseline; text-align: center; display: block;}OUTPUT:

2. Write a XML program that will create an XML document which contains description of three book category.

CODE:

CRIME Sad Cypress Agatha Christie 2001 120.00

CHILDREN Harry Potter J K. Rowling 2005 450.00

ROMANCE Other Words for Love Lorraine Zago Rosenthal 2011 650

BookDetails.cssbook{float: left;width: 260px;height: 135px;padding: 20px;padding-top: 20px;padding-right: 20px;padding-bottom: 20px;padding-left: 20px;margin-right: 20px;background: url(images/templamteo_service_bg.png) right center no-repeat;color: #fff;font-size: 16px;text-decoration: none;}

name{text-align: center;color: #fff;font-size: 36px;font-weight: 700;text-decoration: none;}title,author,year,price{ display: block;}title{ font-family:Book Antiqua; font-size:20px; font-weight: bold; }author{ font-style: italic;}year{ font-family: Verdana;}

price{ font-family:Garamaond;}

OUTPUT:

3. Create an XML document that contains the name and price per pound of coffee beans.i) In your XML document mention all properties of XML declaration.ii) The root element has name iii) Create nested elements for different types of coffee.iv) Validate the document and if any parsing error is present, fix them.

CODE:

Arbica 75-80% 0.8-1.4% 3 Robusta 20-25% 1.7-4% 5

4. Create an XML document that contains airline flight information.i) In your XML document mention all properties of XML declaration.ii) The root element has name iii) Create three nested elements for three separate airlines. Each element should include a name attribute.iv) Within each nest at least two ,each of which contains departure_city, destination_ city, fl_no, dept_time.v) Validate the document and if any parsing error is present fix them.

CODE:

Delhi London AI5788 21:55pm Chennai singapore AI5725 23:15pm Dubai Los Angeles FE8898 01:05am Abu dhabi Lisbon FE5778 20:45pm Newyork London DA4689 02:30am washington Paris DA7853 17:50pm

5. Create an XML version of your resume. Include elements such as your name and position desired. Nest each of your former employers within an element. Also, nest your educational experience within an element.

Create any other nested elements that you deem appropriate, such as or elements.

CODE:CODE:

Priyanka Haldar 51, Station Road, Kolkata-700074 [email protected] 70% 87.6%% 77% 1Comprehensive problem solving abilities. 2.Self motivated, focused and dedicated . 3.Ability to deal with peoplediplomatically. 4.Willingness to learn C,JAVA(core),PHP Software Developer Akash Ghosh Vill+P.O-Begri,P.S-Domjur,Dist-Howrah,state-West Bengal [email protected] 82% 79% 82% 1Comprehensive problem solving abilities. 2.Self motivated, focused and dedicated . 3.Ability to deal with peoplediplomatically. 4.Willingness to learn C,JAVA(core),C# XYZ Technology 2 software developer software Developer

APPLETS

1) Create a banner using Applet/* */import java.awt.*;import java.applet.*;publicclass movingBanner extends Applet implements Runnable{ String msg=" A moving Banner. "; char ch; boolean stopFlag= true; Thread t= null; publicvoid start(){ t = new Thread(this); stopFlag=false; t.start(); }

publicvoid run(){ for(;;){ try{ repaint(); Thread.sleep(250); ch = msg.charAt(0); msg = msg.substring(1,msg.length()); msg = msg + ch; if(stopFlag) break; }catch(InterruptedException e) {} } }

publicvoid stop(){ stopFlag=true; t = null; }

publicvoid paint(Graphics g){ g.drawString(msg,60,30); }}

2) Create different shapes using appletimport java.awt.*;import java.applet.*;

publicclass LineRect extends Applet{ publicvoid paint(Graphics g) { g.drawLine(10,10,50,50); g.drawRect(10,60,40,30); g.setColor(Color.blue); g.fillRect(60,10,30,80); g.setColor(Color.green); g.drawRoundRect(10,100,80,50,10,10); g.setColor(Color.yellow); g.fillRoundRect(20,110,60,30,5,5); g.setColor(Color.red); g.drawLine(100,10,230,140); g.drawLine(100,140,230,10); g.drawString("Line Rectangles Demo",65,180); g.drawOval(230,10,200,150); g.setColor(Color.blue); g.fillOval(245,25,100,100); }};

3) How to fill colors in shapes using applet?import java.applet.*;import java.awt.*;

public class fillColor extends Applet{ public void paint(Graphics g){ g.drawRect(300,150,200,100); g.setColor(Color.yellow); g.fillRect( 300,150, 200, 100 ); g.setColor(Color.magenta); g.drawString("Rectangle",500,150); }}

4) How to go to a link using applet?import java.applet.*;import java.awt.*;import java.net.*;import java.awt.event.*;

public class testURL_NewWindow extends Applet implements ActionListener{ public void init(){ String link_Text = "google"; Button b = new Button(link_Text); b.addActionListener(this); add(b); } public void actionPerformed(ActionEvent ae){ Button source = (Button)ae.getSource(); String link = "http://www."+source.getLabel()+".com"; try { AppletContext a = getAppletContext(); URL url = new URL(link); a.showDocument(url,"_blank"); } catch (MalformedURLException e){ System.out.println(e.getMessage()); } }}

5) How to display image using applet?/* */

import java.awt.*;import java.io.File;import java.io.IOException;import javax.swing.*;import javax.imageio.ImageIO;import java.io.IOException;

public class SummerApplet extends JApplet{Image img;public void init(){String imgSrc"jlaw\\0.gif"; try { img = ImageIO.read(new File(imgSrc)); } catch(IOException ex) { ex.printStackTrace(); } }public void paint(Graphics g){g.drawImage(img,3,50,null);}}

6) How to create an eventlistener using applet?Following example demonstrates how to create a basic Applet having buttons to add & subtract two nos. Methods used here are addActionListener() to listen to an event(click on a button) & Button() constructor to create a button.

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

public class EventListeners extends Applet implements ActionListener{ TextArea txtArea; String Add, Subtract; int i = 10, j = 20, sum =0,Sub=0; public void init(){ txtArea = new TextArea(10,20); txtArea.setEditable(false); add(txtArea,"center"); Button b = new Button("Add"); Button c = new Button("Subtract"); b.addActionListener(this); c.addActionListener(this); add(b); add(c); } public void actionPerformed(ActionEvent e){ sum = i + j; txtArea.setText(""); txtArea.append("i = "+ i + "\t" + "j = " + j + "\n"); Button source = (Button)e.getSource(); if(source.getLabel() == "Add"){ txtArea.append("Sum : " + sum + "\n"); } if(i >j){ Sub = i - j; } else{ Sub = j - i; } if(source.getLabel() == "Subtract"){ txtArea.append("Sub : " + Sub + "\n"); } }}