This document was uploaded by user and they confirmed that they have the permission to share
it. If you are author or own the copyright of this book, please report to us by using this DMCA
report form. Report DMCA
in order to demonstrate<strong>css1 style sheets i created this test content document,which contains samples of most types of web page content
css1 can impact on a document generally, as well as individual elements such as:
<pre>
lists
headers
images
paragraphs
inline paragraphs
tables
forms and form elements
css1 can also alter the presentation of certain pseudo-elements such as hypertext links or the first line or character within a line. ther actually isntanything that cant in some way
OUTPUT:
RESULT: Thus the html program as be executed successfully and the result is displayed.
PROGRAM: table examples
OUTPUT:
RESULT: Thus the html program as be executed successfully and the result is displayed.
RESULT: Thus the program to display page elements has been executed successfully.
PROGRAM:
simple multiplication <script type="text/javascript"> function multiply() { var number_one=document.the_form.field_one.value; var number_two=document.the_form.field_two.value; var result=number_one*number_two; alert(number_one+"times"+number_two+"is:"+result); }
OUTPUT:
RESULT: Thus the java script program for multiplying two numbers executed successfully.
PROGRAM:
<TITLE>A JavaScript Order Form
A JavaScript Order Form
<SCRIPT LANGUAGE="JavaScript1.1">
var x = form.OrderItem.options[form.OrderItem.selectedIndex].value; var y = form.Quantity.options[form.Quantity.selectedIndex].value; var due = (x * y); form.Total.value = due; //-->
OUTPUT:
RESULT: Thus the form for ordering products in online as been executed successfully.
PROGRAM: <script type="text/javascript"> function checkMandatoryFields() { var error_Message=" "; //check text box if(window.document.the_form.the_text.value=="") { error_Message+="please enter your name.\n"; } //check scrolling list if(window.document.the_form.state.selectedIndex<0) { error_Message+="please select a state.\n"; } //check radio button var radio_selected="false"; for(var index=0;index < window.document.the_form.gender.length; index++) { radio_Selected="true"; }
}
if(radio_Selected=="false") { error_Message+="Please select a gender.\n"; } if(error_Message==" ") { return true; } else error_Message="please correct the following errors:\n\n"+error_Message; alert(error_Message); return false; } }
please provide youuur details below
OUTPUT:
RESULT: Thus the java script for form validation has been executed successfully.
PROGRAM:
Enabling and Disable Style Sheet <style> body { background-color:white } h1 { font-size:30pt; font-weight:bold; color:red } h2 { font-size:18pt; color:green; background-color:cyan p
}
{ font-size:12pt; color:purple; text-indent:30px
}
<script language="java script">
Title
First Paragraph
This is the first paragraph,it is very short
Second Paragraph
This is the second paragraph,it is short too
OUTPUT:
RESULT: Thus the java script for enabling and disabling style sheet has been executed successfully.
PROGRAM:
<TITLE>Accessing elements by their id <STYLE type="text/css"> span{color:orange; } .hidden{visibility:hidden;color:green;} <SCRIPT language=”javascript”> function mClick( ) { if(document.all.hid.style.visibility="visible") { document all.hid.style.visibility="visible"; document all.hid.style.backgroundColor=”yellow"; } else { document.all.hid.style.visibility="hidden"; document.all.hid.style.backgroundColor="white"; } } In the month of April there was a lot of <SPAN onClick=’mClick();’>
precipitation <SPAN class=”hidden" id="hid"> Precipitation: Water that falls on the earths surface as rain, sleet, snow, etc.
OUTPUT:
RESULT: Thus the java script for Accessing elements using their ID has been executed successfully.
PROGRAM:
HOME PAGE <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> Untitled Page
SRI VENKATESWARA COLLEGE
ABOUT US: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> Untitled Page
Sri Venkateswara College of Computer Applications and Management (SVCCAM) was founded in 2007 as a self-financing institution promoted by the Sri Venkateswara Educational and Charitable Trust. This Trust is headed by the founder Commander K.Velu, a former Principal of leading Institutions in Coimbatore till Sep 2006 and Mrs.Megala Velu contributes her service as the Secretary of the Trust.
MCA @ Sri Venkateswara College of Computer Applications and Management is established with the objective of producing talented software engineers.
The Department is headed by Dr.M.Arthanari who has thirty four years of experience in the educational field. Previously he has served as a principal of Erode Arts College (Autonomous). The department also has eight faculty members in different areas of specialization like database management systems, network security, e-commerce, visual programming and all languages.
MBA @ Sri Venkateswara College of Computer Applications and Management is established with the objective of producing students of managerial excellence.
The department has six faculty members in different areas of specialization like Marketing, Human Resource Management, Financial Management, Production & Quality Management and Portfolio Management.
OUTPUT:
RESULT: Thus the website has been developed successfully using HTML and DHTML tags.
public class mark { public String name, rno; public int ma1,ma2,ma3,ma4,ma5,tot,avg;
private void getdata() throws IOException, SQLException { try { DataInputStream in = new DataInputStream(System.in); System.out.println("Creation Details"); System.out.print("Enter the Name"); name = in.readLine(); System.out.print("Enter the rollno:"); rno = in.readLine(); System.out.print("nter the mark 1"); ma1 = Integer.parseInt(in.readLine()); System.out.print("Enter the mark 2"); ma2 = Integer.parseInt(in.readLine()); System.out.print("Enter the mark 3"); ma3 = Integer.parseInt(in.readLine()); System.out.print("Enter the mark 4");
ma4 = Integer.parseInt(in.readLine()); System.out.print("Enter the mark 5"); ma5 = Integer.parseInt(in.readLine()); } catch(Exception e) { System.out.println(e); } }
public void create() throws IOException, SQLException { Connection con; Statement st; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con= DriverManager.getConnection("jdbc:odbc:mark1","",""); st = con.createStatement(); DataInputStream in = new DataInputStream(System.in); getdata(); tot = ma1 + ma2 + ma3 + ma4+ ma5; avg = tot/5; String query = "insert into mark values('"+name+"','"+rno+"',"+ma1+","+ma2+","+ma3+","+ma4+","+ma5+","+t ot+","+avg+");"; st.execute(query);
st.close(); con.close(); } catch(Exception e) { System.out.println("This roll no : "+rno+" is already created"); } }
void cancel() { Connection con; Statement st; ResultSet rs; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con= DriverManager.getConnection("jdbc:odbc:mark1","",""); st = con.createStatement(); DataInputStream in = new DataInputStream(System.in); System.out.print("enter roll no:"); rno = in.readLine(); String query1 = "delete * from mark where rno = '"+rno+"' "; st.executeUpdate(query1); System.out.println("The acc no: "+rno+" is canceled"); st.close();
{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con= DriverManager.getConnection("jdbc:odbc:mark1","",""); st = con.createStatement(); DataInputStream in = new DataInputStream(System.in); System.out.print("enter the name"); name = in.readLine(); System.out.print("Enter the rollno:"); rno = in.readLine(); String query = "update mark set name = '"+name+"',rno = '"+rno+"' where no = '"+rno+"'"; st.executeUpdate(query); System.out.println("The roll no"+rno+" is Updated"); st.close(); con.close(); }
RESULT: Thus the program has been executed successfully and the result is displayed.
PROGRAM: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class ProductInfo extends JFrame implements ActionListener { /*Declare the variables to create the application interface for the Product Information application*/ JLabel heading, id, desc, rate, quantity, unit_of_msr, empty_label,error; JTextField idField, descField, rateField, quantityField, unit_of_msrField; JButton insert, update, delete, clear, exit; GridBagLayout gbl; GridBagConstraints gbc; JComboBox idCombo; Connection con; PreparedStatement stat; Statement stmt; ResultSet rs; Font f; JPanel jp1; /*Define the constructor for the Product Information application*/ public ProductInfo() {
setTitle("Product Information"); setSize(600, 300); /*Register the WindowListener interface to define the windowClosing() method*/ addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } }); /*Initialize the JPanel object*/ jp1=new JPanel(); /*Set the BorderLayout as the layout manager*/ getContentPane().setLayout(new BorderLayout()); /*Initialize the GridBagLayout object*/ gbl = new GridBagLayout(); /*Initialize the GridBagConstraints object*/ gbc = new GridBagConstraints(); jp1.setLayout(gbl); f = new Font("Monospaced", Font.BOLD, 24); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 3; /*Initialize the JLabel object to set the caption for the application*/ heading = new JLabel("Product Information"); /*Set the font for the caption*/
heading.setFont(f); /*Add the caption to the Panel*/ jp1.add( heading, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 5; empty_label = new JLabel(""); empty_label.setFont(f); jp1.add( empty_label, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.gridwidth = 1; /*Initialize the id JLabel object*/ id = new JLabel("ID", SwingConstants.LEFT); /*Add the label, id to the panel*/ jp1.add( id, gbc); gbc.gridx = 2; gbc.gridy = 2; gbc.gridwidth = 1; /*Initialize the idField JTextField object*/ idField = new JTextField(10); /*Add the JtextField object, idField to the panel*/ jp1.add( idField, gbc); gbc.gridx = 3; gbc.gridy = 2; gbc.gridwidth = 1;
/*Initialize the idCombo JComboBox object*/ idCombo = new JComboBox(); /*Set the editable option of idCombo object to false*/ idCombo.setEditable(false); /*Add the JComboBox object, idCombo to the panel*/ jp1.add(idCombo, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.gridwidth = 1; /*Initialize the desc JLabel object*/ desc = new JLabel("Description", SwingConstants.LEFT); /*Add the desc JLabel object to the panel*/ jp1.add( desc, gbc); gbc.gridx = 2; gbc.gridy = 3; gbc.gridwidth = 2; /*Initialize the descField JTextField object*/ descField = new JTextField(20); /*Add the descField JTextField object to the panel*/ jp1.add( descField, gbc); gbc.gridx = 1; gbc.gridy = 4; gbc.gridwidth = 1; /*Initialize the rate JLabel object*/ rate = new JLabel("Rate", SwingConstants.LEFT); /*Add the rate JLabel object to the panel*/
jp1.add( rate, gbc); gbc.gridx = 2; gbc.gridy = 4; gbc.gridwidth = 2; /*Initialize the rateField JTextField object*/ rateField = new JTextField(20); /*Add the rateField object to panel*/ jp1.add( rateField, gbc); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 1; /*Initialize the quantity JTextField object*/ quantity = new JLabel("Quantity", SwingConstants.LEFT); /*Add the quantity object to panel*/ jp1.add( quantity, gbc); gbc.gridx = 2; gbc.gridy = 5; gbc.gridwidth = 2; /*Initialize the quantityField JTextField object*/ quantityField = new JTextField(20); /*Add the quantityField object to panel*/ jp1.add( quantityField, gbc); gbc.gridx = 1; gbc.gridy = 6; gbc.gridwidth = 1; /*Initialize the unit_of_msr JLabel object*/
unit_of_msr = new JLabel("Unit of Measurement ",SwingConstants.LEFT); /*Add the unit_of_msr object to panel*/ jp1.add( unit_of_msr, gbc); gbc.gridx = 2; gbc.gridy = 6; gbc.gridwidth = 2; /*Initialize the unit_of_msrField JTextField object*/ unit_of_msrField = new JTextField(20); /*Add the unit_of_msrField object to panel*/ jp1.add( unit_of_msrField, gbc); gbc.gridx = 0; gbc.gridy = 7; gbc.gridwidth = 1; /*Initialize the insert JButton object*/ insert = new JButton("Insert"); /*Register ActionListener on insert JButton object*/ insert.addActionListener(this); /*Add the insert object to the panel*/ jp1.add( insert, gbc); gbc.gridx = 1; gbc.gridy = 7; gbc.gridwidth = 1; /*Initialize the update JButton object*/ update = new JButton("Update"); /*Register ActionListener on update JButton object*/ update.addActionListener(this);
/*Add update object to panel*/ jp1.add( update, gbc); gbc.gridx = 2; gbc.gridy = 7; gbc.gridwidth = 1; /*Initialize the delete JButton object*/ delete = new JButton("Delete"); /*Register ActionListener on delete JButton object*/ delete.addActionListener(this); /*Add delete object to panel*/ jp1.add( delete, gbc); gbc.gridx = 3; gbc.gridy = 7; gbc.gridwidth = 1; /*Initialize the clear JButton object*/ clear = new JButton("Clear"); /*Register ActionListener on clear JButton object*/ clear.addActionListener(this); /*Add the clear JButton object to panel*/ jp1.add( clear, gbc); gbc.gridx = 4; gbc.gridy = 7; gbc.gridwidth = 1; /*Initialize the exit JButton object*/ exit = new JButton("Exit"); /*Register ActionListener on exit JButton object*/
exit.addActionListener(this); /*Add the exit JButton object to panel*/ jp1.add( exit, gbc); /*Initialize the error JLabel object*/ error = new JLabel(""); /*Add jp1 JPanel object in the center of the contentpane*/ getContentPane().add(jp1,"Center"); /*Add error JLabel object to the contentpane*/ getContentPane().add(error,"South"); try { /*Initialize and load JDBC-ODBC bridge driver*/ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); /*Connect to a data source*/ con = DriverManager.getConnection("jdbc:odbc:qw"); /*Create a Statement object*/ stmt = con.createStatement(); /*Retrieve the rows from the product table and store them in the result set object rs*/ rs = stmt.executeQuery("SELECT p_id FROM product"); /*Display the p_id values in the idCombo object*/ while (rs.next()) { idCombo.addItem(Integer.toString(rs.getInt(1))); /*Close the Connection object*/ con.close(); }
}
catch(Exception e) { System.out.println("Error : "+e); } idCombo.addActionListener(this); } public void actionPerformed(ActionEvent ae) { if(ae.getActionCommand() == "Exit") /*Terminate the execution of the application*/ System.exit(0); if(ae.getActionCommand() == "Delete") { /*Delete the selected row from the product table*/ try { /*Initialize the con Connection object */ con = DriverManager.getConnection("jdbc:odbc:qw"); /*Initialize the stat PreparedStatement object to delete a row*/ stat = con.prepareStatement("DELETE from Product WHERE p_id = ?"); String selected_id = idCombo.getSelectedItem().toString(); int id = Integer.parseInt(selected_id); stat.setInt(1, id); /*Execute the query*/ stat.executeUpdate(); /*Close the connection*/
con.close(); /*Remove ActionListener from idCombo JComboBox object*/ idCombo.removeActionListener(this); /*Initialize the con Connection object*/ con = DriverManager.getConnection("jdbc:odbc:qw"); /*Initialize the stmt Statement object*/ stmt = con.createStatement(); /*Store all the rows of the product table in the rs ResultSet object*/ rs = stmt.executeQuery("SELECT p_id FROM product"); /*Remove all the elements from the idCombo JcomboBox object*/ idCombo.removeAllItems(); while (rs.next()) idCombo.addItem(Integer.toString(rs.getInt(1))); con.close(); idCombo.addActionListener(this); idField.setText(""); descField.setText(""); rateField.setText(""); quantityField.setText(""); unit_of_msrField.setText(""); error.setText("Row Deleted"); } catch(Exception e) { System.out.println("Error " + e ); error.setText("Row cannot be deleted");
} } if(ae.getActionCommand() == "Insert") { //Insert a row in the product table try { con = DriverManager.getConnection("jdbc:odbc:qw"); stat = con.prepareStatement("INSERT INTO Product VALUES(?, ?, ?, ?, ?)"); String id = idField.getText(); String description = descField.getText(); String rate = rateField.getText(); String quantity = quantityField.getText(); String unit_of_msr = unit_of_msrField.getText(); stat.setInt(1, Integer.parseInt(id)); stat.setString(2, description); stat.setDouble(3, Double.parseDouble(rate)); stat.setInt(4, Integer.parseInt(quantity)); stat.setString(5, unit_of_msr); /*Execute the INSERT statement*/ stat.executeUpdate(); con.close(); idCombo.removeActionListener(this); con = DriverManager.getConnection("jdbc:odbc:qw"); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT p_id FROM product");
idCombo.removeAllItems(); while (rs.next()) /*Refresh the id values in the idCombo JComboBox after inserting a new row*/ idCombo.addItem(Integer.toString(rs.getInt(1))); con.close(); idCombo.addActionListener(this); error.setText("Row Inserted"); } catch(Exception e) { System.out.println("Error1 "+e); error.setText("Row cannot be inserted"); } } if(ae.getSource() == idCombo) { /*Display the row corresponding the id selected in the idCombo combobox*/ try { con = DriverManager.getConnection("jdbc:odbc:qw"); String selected_id = idCombo.getSelectedItem().toString(); Integer.parseInt(selected_id);
descField.setText(rs.getString(1)); rateField.setText(Double.toString(rs.getDouble(2))); quantityField.setText(Integer.toString(rs.getInt(3))); unit_of_msrField.setText(rs.getString(4)); con.close(); } catch(Exception e) { System.out.println("Error " + e); } } if(ae.getActionCommand()=="Update") { try { con = DriverManager.getConnection("jdbc:odbc:qw"); /*Initialize the stat PreparedStatement object to update a row in the product table*/ stat = con.prepareStatement("UPDATE Product SET p_desc = ?, p_rate = ?, p_qty = ?, unit_of_msr = ? where p_id = ?"); String description = descField.getText(); String rate = rateField.getText(); String quantity = quantityField.getText(); String unit_of_msr = unit_of_msrField.getText(); String id_selected = idField.getText(); int id = Integer.parseInt(id_selected); stat.setString(1, description); stat.setDouble(2, Double.parseDouble(rate));
stat.setInt(3, Integer.parseInt(quantity)); stat.setString(4, unit_of_msr); stat.setInt(5, id); /* Execute the UPDATE statement*/ stat.executeUpdate(); con.close(); error.setText("Row Updated"); } catch(Exception e) { System.out.println("Error " + e ); error.setText("Cannot update the row"); } } if(ae.getActionCommand() == "Clear") { /*Clear the contents of all the fields*/ idField.setText(""); descField.setText(""); rateField.setText(""); quantityField.setText(""); unit_of_msrField.setText(""); } } public static void main(String args[]) {
ProductInfo p = new ProductInfo(); p.show(); } }
OUTPUT:
RESULT: Thus the program has been executed successfully and the result is displayed.
PROGRAM:
Welcome page .html
GET AUTHORNAME.JSP: <%-- Import the package --%> <%@ page import ="java.util.*" %> <%@ page import = "test.FindAuthor" %> JSP and JavaBean
<%-- Create an instance of FindAuthor class --%>
<jsp:useBean id="FA" scope="application" class="test.FindAuthor" /> <%-- Set the value of various attribute, such as authorId, url, and driverName --%>
<jsp:setProperty name="FA" property="*" />
<%-- The details about the author, <jsp:getProperty name="FA" property="authorName"/> is: --%> <% /* Create an instance of type of Vector and invoking the function getResult() to return the result set*/ Vector v = (Vector)FA.getResult(); Enumeration enum = v.elements(); /* Prints the elements in the vector variable */ while(enum.hasMoreElements()) { out.println("Author Name:"+enum.nextElement()); %> <% out.println("Address:"+enum.nextElement()); %> <% out.println("City:"+enum.nextElement()); %> <% out.println("State:"+enum.nextElement()); %> <% out.println("ZIP:"+enum.nextElement()); } %> OUTPUT:
RESULT: Thus the JSP program has been executed successfully and the result is displayed.
PROGRAM:
<script type="text/javascript"> var d= new Date(); var weekday= new Array("Sunday","Monday","Tuesday","Wednesday", "thursday","friday","saturday"); var monthname=new Array("jan","feb","mar","apr","may","jun", "jul","aug","sep","oct","nov","dec"); document.write(weekday[d.getDay()]+" "); document.write(monthname[d.getMonth()]+" "); document.write(d.getFullYear());
OUTPUT:
RESULT: Thus the program has been successfully executed and the result is displayed.