Image mapping

<html> <body> <p> <b>Some Popular Planets from Solar system</b> </p> <img src="C:\Documents and Settings\User\My Documents\My Pictures\solar system.jpg" width="145" height="126" usemap="#solarmap"> <map id="solarmap" name="solarmap"> <area shape="rect" coords="10,10,40,25" alt="Mercury" href="D:\\HTML_Examples\Mercury.html"> <area shape="rect" coords="35,20,75,55" alt="venus" href="D:\\HTML_Examples\venus.htm"> <area shape="rect" coords="65,55,115,85" alt="Earth" href="D:\\HTML_Examples\earth.htm"> <area shape="rect" coords="90,85,135,120" alt="Saturn" href="D:\\HTML_Examples\saturn.htm"> </map> <p><b>Note:</b> Some Planets from our solar system are displayed here click on any planet and you will get some useful information about them</p> </body> </html>

Output:

See more computer hardware pictures. background-position:center. } h3 { border-width:thin.Ex #2: Types of Cascading Style Sheets <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1. serif. border-style:dashed. . charset=iso-88591" /> <title>Types of CSS</title> <!--External Style Sheet--> <link rel="stylesheet" type="text/css" href=" external.dtd"> <html xmlns="http://www.0 Transitional//EN" "http://www. border-top-color:#00FF66. background-repeat:repeat-x. font-family:Georgia. border-width:thick.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html. font-size:18px. Times. RAM is considered "random access" because you can access any memory cell directly if you know the row and column that intersect at that cell. } </style> </head> <body> <h4 style="text-align:center">This is the output for External Stylesheet</h4> <h1>Hi</h1> <h4 style="text-align:center">This is the output for Internal or Embedded Stylesheet</h4> <h2>Hello</h2> <h3>Welcome</h3> <p> RAM is the best known form of computer memory and easy to upgrade.css" /> <!--Internal or Embedded Style Sheet--> <style type="text/css"> h2 { background-color:#009933.org/TR/xhtml1/DTD/xhtml1-transitional. "Times New Roman".w3.w3. Random access memory (RAM) is the best known form of computer memory.

} . Helvetica. text-decoration:line-through. </p> </html> external. } P { font:Arial. font-variant:small-caps."> </body>RAM is the best known form of computer memory and easy to upgrade. RAM is considered "random access" because you can access any memory cell directly if you know the row and column that intersect at that cell. text-transform:uppercase.css body { font-family: Arial. color: #CC3300. background:#999999./. font-size-adjust:inherit.. Random access memory (RAM) is the best known form of computer memory. sans-serif. See more computer hardware pictures. Helvetica. font-size:12px. sans-serif. text-align:center./Program Files/Apache Software Foundation/Tomcat 6. font-weight:900.</p> <!-. font-stretch:ultra-condensed./...jpg).0/Sunset. Helvetica. border:thin. background-image:url(. } h1 { font-family: Arial.Inline StyleSheet--> <h4 style="text-align:center">This is the output for InLine Stylesheet</h4> <p style="background:#CC0033. sans-serif.

Output: .

i < ph_str. var ph_str=document.value=="") { alert("Enter Some Age") return false } if((document.ph_txt.my_form.value.indexOf("@") .charAt(i).length>11) { alert("Invalid length of Phone Number") return false } for (i = 0.my_form.focus() return false } } var index_at=str.length<1 ||ph_str. var name_str=document.name.value.Age_txt.value==null)||(name_str.value<"5")&& (document.my_form.Age_txt.my_form.my_form.value>"21")) { alert("Invalid Age") return false } if(ph_str.length. i++) { var ch = ph_str. var str=document. if (((ch < "0") || (ch > "9"))){ alert("Invalid Phone Number") phoneID. if((name_str.my_form.Ex #3: <html> <head> <title>The Student Registration Form</title> <script type=text/javascript> function validate() { var i.Email_txt.my_form. var phoneID=document.value=="")) { alert("Enter some name") return false } if(document.ph_txt.Age_txt.

return false.value=="")) { alert("Please Enter your Email ID") emailID.")==index_at) { alert("Invalid E-mail ID") return false } if (str.focus() return false } if (str.(index_at+1))!=-1) { alert("Invalid E-mail ID") return false } if (str.my_form.my_form.")==0 || str.Email_txt if ((emailID.indexOf(".checked && !document.var len=str.checked) { alert("Please Select Sex").indexOf(".my_form.group1[0].group1[0].my_form. return false.indexOf("@")==-1) { alert("Invalid E-mail ID") return false } if (str.indexOf(".checked && !document. } return true } .indexOf("@". } if (!document.checked) { alert("Please Select Sex").group1[0].") var emailID=document.my_form.value==null)||(emailID.indexOf(" ")!=-1) { alert("Invalid E-mail ID") return false } if (!document.length var index_dot=str.group1[0].")==-1 || str.indexOf(".

">Watching T.V<br/> <br/><br/> <strong>Country:</strong> <select name="My_Menu"> <option value="India">India</option> <option value="China">China</option> <option value="Shrilanka">Shrilanka</option> </select> <center> <input type=submit value=Submit></br> </center> </body> </html> .</script> </head> <body bgcolor=aqua> <center><h3>Application Form</h3></center> <form name=my_form onsubmit=validate()> <strong>Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</strong> <input type=text name=name><br/> <strong>Age:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</strong> <input type=text name=Age_txt><br/> <strong>Phone No:&nbsp</strong> <input type=text name=ph_txt><br/> <strong>Email:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</strong> <input type=text name=Email_txt><br/><br/> <strong>Sex:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp </strong> <input type="radio" name="group1" value="Male">Male&nbsp&nbsp&nbsp&nbsp <input type="radio" name="group1" value="Female">Female<br/><br/><br/> <strong>Hoby: </strong> &nbsp&nbsp <input type="checkbox" name ="option1" value="Singing">Singing<br/> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="checkbox" name ="option1" value="Reading">Reading<br/> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="checkbox" name ="option1" value="T.V.

Output: .

import java.*. Button buttons[]=new Button[5]. Checkbox box3=new Checkbox("Loading Image".yellow).red). String colours[]={"Red". Image img. add(buttons[i]).Ex #4: Source Code: App. Checkbox box1=new Checkbox("Background Color". int flag=1.cbg. buttons[2]."Magenta"}.true). add(box2).setBackground(Color.awt. buttons[1].*. String text="Click any of the button". } buttons[0]."Blue". import java.setBackground(Color.setBackground(Color. /* <applet code="Experiment3" width=300 height=300> </applet> */ public class app extends Applet implements ItemListener { int currcolor=5. add(box3). buttons[3]."Yellow". public void init() { for(int i=0.cbg. .addItemListener(this).awt.false)."Green".i<5.*.setBackground(Color.blue). buttons[4]. box1.event.setBackground(Color.magenta).java //This program changes the color of text //It also set the background color //It also loads the image //It makes use of checkboxgroup and button import java.false). CheckboxGroup cbg=new CheckboxGroup().green). Checkbox box2=new Checkbox("Text Color". add(box1).cbg.i++) { buttons[i]=new Button(" ").applet.

} repaint(). flag=2. flag=3. } public void itemStateChanged(ItemEvent ev) { if(box1. box3.getState()==true) { img=getImage(getDocumentBase().30. break.getState()==true) flag=1. switch(currcolor) { case 0: g.black).box2. break.setColor(Color.setColor(Color.setColor(Color. case 5: g. case 3: g. case 1: g.addItemListener(this).drawString(text.drawString(text.green).setColor(Color."cutecat. case 4: g.jpg"). else if(box2.setColor(Color. . break. } else if(box3.30. } public void paint(Graphics g) { if(flag==2) { g. case 2: g. break.addItemListener(this).yellow). break.magenta).getState()==true) { text="Default color is black". break.red).blue). } g.100).100).setColor(Color.

case 4: setBackground(Color. break.magenta). return true.i++) { if(e. break. case 2: setBackground(Color. break. text="You have chosen "+colours[i]. break.i<5. switch(currcolor) { case 0: setBackground(Color.target==buttons[i]) { currcolor=i. break. repaint().green).drawString(text. } } else if(flag==3) { g. case 1: setBackground(Color. break.90.drawImage(img.Object o) { for(int i=0.20.blue). case 3: setBackground(Color.} else if(flag==1) { g. } } public boolean action(Event e. } } return false.100). } .30.white). case 5: setBackground(Color.yellow).red).this).

} Output: Ex #5: .

import java.ServletResponse res) throws ServletException.*.println(value_received). } } HTML Program: <html> <head> <title>Student Information Form</title> </head> <body> <center> <form name="form1" action="http://localhost:8080/my_servletDemo" method="post"> <h3>Enter student information in following fields -</h3> <table> <tr> <td><b>Roll Number</b></td> <td><input type="text" name="Roll Number" size="25" value=" "></td> </tr> .nextElement().java Servlet Program: import java. String value_received=req.Source Code: my_servletDemo. public class my_servletDemo extends GenericServlet { public void service(ServletRequest req. import javax.servlet.getParameterNames().IOException { PrintWriter out=res. out.close(). out. while(en.getWriter(). out.print(name_received+ " = "). Enumeration en=req.util.io. } out.println(" ").*.getParameter(name_received).*.hasMoreElements()) { String name_received=(String)en.

<tr> <td><b>Student Name</b></td> <td><input type="text" name="Student Name" size="25" value=" "></td> </tr> <tr> <tr> <td><b>Student Address</b></td> <td><input type="text" name="Address" size="50" value=" "></td> </tr> <tr> <td><b>Phone</td> <td><input type="text" name="Phone" size="25" value=" "></td> </tr> <tr> <td><b>Total Marks</td> <td><input type="text" name="Total Marks" size="10" value=" "></td> </tr> </table> <input type="submit" value="submit"> </form> </center> </body> </html> Output: .

.

*" %> <%@ page import="java. . if(ans1.getParameter("Seat_no"). Statement stmt=null. int a1.sql.equals("True")) a1=2.ans2.odbc.*" %> <%@ page import="java. ans1 =request.ans4. else a1=0.JdbcOdbcDriver").getParameter("group1"). Name = request. Class.getParameter("action")!=null) { SeatNum = request.a3.io.forName("sun.a4.getParameter("Name").util.*" %> <% String SeatNum. connect = DriverManager. " ").a2.Name. " ".jdbc. String url = "jdbc:odbc:StudentDB1". String ans1. ResultSet rs=null. a1=a2=a3=a4=a5=0.Ex #6 Source code: <%@ page language="java" import="java.ans3.getConnection(url.a5.ans5. if(request. Connection connect=null.

stmt.getParameter("group4"). if(ans3.Name. '"+Total+ "')". '" + Name + "'. ans3 = request.createStatement(). else a3=2. String query = "INSERT INTO StudentTable (" + "Seat_no. else a5=2.createStatement().equals("True")) a2=0. if(ans5.close().equals("True")) a5=0. stmt = connect.getParameter("group5"). stmt = connect.ans2 = request. if(ans4. if(ans2.equals("True")) a4=2. int result = stmt.equals("True")) a3=0. ans4 = request. ans5 = request.Marks" + ") VALUES ('" +SeatNum + "'. else a2=2.getParameter("group2").executeUpdate(query). else a4=0. int Total=a1+a2+a3+a4+a5.getParameter("group3"). .

getInt(1)%></td> <td> <%=rs.query = "SELECT * FROM StudentTable WHERE Name="+"'"+Name+"'".getString(3)%></td> </tr> <% } rs.close().close(). %> <html><head><title>Student Mark List</title></head> <body bgcolor=khaki> <center> <h2>Students Marksheet</h2> <h3>Name of the College:ABC College of Engineering</h3> <table border="1" cellspacing="0" cellpadding="0"> <tr> <td><b>Seat_No</b></td> <td><b>Name</b></td> <td><b>Marks</b></td> </tr> <% while(rs. stmt.next()) { %> <tr> <td><%=rs.getString(2)%></td> <td> <%=rs.executeQuery(query). . rs = stmt.

0.Name.Y.util.length==0) { alert("Please.Date().connect.length==0) { .focus().close().toString() %></td></tr> <tr><td><b>Signature: X. Form_obj. return false.Z.jsp">Click here to go back</a> </body> </html> <%}else{%> <html> <head><title>Online Examination</title> <script language="javascript"> function validation(Form_obj) { if(Form_obj.Seat_no.value. <b></td></tr> </table> <div> <a href="http://127.0.value. %> </table> </center> <br/> <br/><br/> <table> <tr><td><b>Date:<%=new java.fill up the Seat Number").1:8080/jsp-examples/StudExam/Exam.Seat_no. } if(Form_obj.

jsp" method="post" name="entry" onSubmit="return validation(this)"> <input type="hidden" value="list" name="action"> <table> <tr> <td><h3>Seat Number:</h3></td> <td><input type="text" name="Seat_no"></td> </tr> <tr> <td><h3>Name:</h3></td> <td><input type="text" name="Name" size="50"></td> </tr> <hr/> <tr> <td><b>Total Marks:10(Each question carries equal marks) </b></td> . return false.fill up the Name").focus(). } </script> </head> <body bgcolor=lightgreen> <center> <h1>OnLine Examination</h1> </center> <form action="Exam. Form_obj.alert("Please.Name. } return true.

Apache is an open source web server</b><br/> <input type="radio" name="group1" value="True">True <input type="radio" name="group1" value="False">False<br> <br/> <b>2.</b><br/> <input type="radio" name="group4" value="True">True <input type="radio" name="group4" value="False">False<br> <br/> <b>5.</b><br/> <input type="radio" name="group2" value="True">True <input type="radio" name="group2" value="False">False<br> <br/> <b>3.</b><br/> <input type="radio" name="group3" value="True">True <input type="radio" name="group3" value="False">False<br> <br/> <b>4.<td></td><td></td><td></td><td><b>Time: 15 Min.</b></td> </tr> </table> <hr/> <b>1. HTTP is a statefull protocol</b><br/> <input type="radio" name="group5" value="True">True <input type="radio" name="group5" value="False">False<br> . Tim-Berner Lee is the originator of Java.JPG is not a video file extension. In Modern PC there is no cache memory.

<hr/> <center> <input type = "submit" value="Submit"> <input type = "reset" value="Clear"><br><br> </center> </form> <%}%> OUTPUT: .

xsl"?> <Student> <Person-Details> <name>Anand</name> <address>Pune</address> <std>Second</std> <marks>70 percent</marks> </Person-Details> <Person-Details> .0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="SimpleXml.xml <?xml version="1.Exp:7 SimpleXML.

xsl <?xml version="1.<name>Anuradha</name> <address>Chennai</address> <std>Second</std> <marks>90 percent</marks> </Person-Details> <Person-Details> <name>Archana</name> <address>Mumbai</address> <std>Forth</std> <marks>80 percent</marks> </Person-Details> <Person-Details> <name>Monika</name> <address>Delhi</address> <std>Tenth</std> <marks>77 percent</marks> </Person-Details> </Student> SimpleXMl.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>Students Database</h2> <table border="1"> <tr> <th>Name</th> <th>Address</th> <th>Standard</th> <th>Marks</th> </tr> <xsl:for-each select="Student/Person-Details"> <tr> <td><xsl:value-of select="name"/></td> .0" xmlns:xsl="http://www.

<td><xsl:value-of select="address"/></td> <td><xsl:value-of select="std"/></td> <td><xsl:value-of select="marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> OUTPUT: .

Sign up to vote on this title
UsefulNot useful