How To Use Dreamweaver |
Click on any image for larger version
software available in http://www.study11.com/
|
Tuesday, 27 March 2012
Dreamweaver
Monday, 26 March 2012
DISPLAYING CRICKET PLAYERS PROFILE USING AJAX
11) DISPLAYING CRICKET PLAYERS PROFILE USING AJAX
AIM:
To write a program using AJAX for displaying cricket players profile.
ALGORITHM:
1. Create an XHTML document (AjaxDemo.html) with the following.
(a) Insert some images of cricket players.
(b) Call the function getContent() with respect to the onmouseover event. The function accepts an argument that is the URL of another page contains the information about the player.
(c) Call the function clearContent() with respect to the onmouseout event.
2. Within this XHTML document, insert AJAX based JavaScript code with the following.
(a) Create the object for ActiveXObject (for older versions of browsers such as IE5 and IE6).
(b) Create the object for XMLHttpRequest (for modern browsers such as IE7+, Firefox, Chrome, Safari, and Opera).
(c) AJAX send the request with the use of send() and open() methods.
(d) Receive the response with the use of responseText Property.
(e) AJAX Call the function diplayProfile() with respect to the event onreadystatechange.
PROGRAM:
AjaxDemo.html
<html>
<head>
<title>Ajax Demo...</title>
<style type="text/css">
.box{border:1px solid blue;padding:10px}
</style>
<script type="text/javascript">
var req;
function getContent(url)
{
if(window.ActiveXObject)
{
req=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
req=new XMLHttpRequest();
}
req.onreadystatechange=diplayProfile;
req.open('POST',url,true);
req.send(null);
}
function diplayProfile()
{
if(req.readyState==4)
{
document.getElementById('contentArea').innerHTML=req.responseText;
}
}
function clearContent()
{
document.getElementById('contentArea').innerHTML='';
}
</script>
</head>
<body bgcolor="cyan">
<h1>Mouse over the image for More Information</h1>
<img src="sachin.jpg" height="95" width="80" onmouseover='getContent("sachin.html")' onmouseout='clearContent()'/>
<img src="dravid.jpg" height="95" width="80" onmouseover='getContent("dravid.html")' onmouseout='clearContent()'/>
<img src="kohli.jpg" height="95" width="80" onmouseover='getContent("kohli.html")' onmouseout='clearContent()'/>
<img src="raina.jpg" height="95" width="80" onmouseover='getContent("raina.html")' onmouseout='clearContent()'/>
<img src="yuvi.jpg" height="95" width="80" onmouseover='getContent("yuvi.html")' onmouseout='clearContent()'/>
<img src="veeru.jpg" height="95" width="80" onmouseover='getContent("veeru.html")' onmouseout='clearContent()'/>
<img src="dhoni.jpg" height="95" width="80" onmouseover='getContent("dhoni.html")' onmouseout='clearContent()'/>
<div class="box" id="contentArea"/>
</body>
</html>
sachin.html
<html>
<body>
<b>Full name:</b> Sachin Ramesh Tendulkar<br/><br/>
<b>Born:</b> April 24, 1973, Bombay (now Mumbai), Maharashtra<br/><br/>
<b>Major teams:</b> India, Asia XI, Mumbai, Mumbai Indians, Yorkshire<br/><br/>
<b>Nickname:</b> Tendlya, Little Master<br/><br/>
<b>Playing role:</b> Top-order batsman<br/><br/>
<b>Batting style:</b> Right-hand bat<br/><br/>
<b>Bowling style:</b> Right-arm offbreak, Legbreak googly
</body></html>
dravid.html
<html>
<body>
<b>Full name:</b> Rahul Sharad Dravid<br/><br/>
<b>Born:</b> January 11, 1973, Indore, Madhya Pradesh <br/><br/>
<b>Major teams:</b> India, Scotland, Asia XI, ICC World XI, Karnataka, Kent,
Marylebone Cricket Club, Rajasthan Royals, Royal Challengers Bangalore<br/><br/>
<b>Nickname:</b> The Wall<br/><br/>
<b>Playing role:</b> Top-order batsman<br/><br/>
<b>Batting style:</b> Right-hand bat<br/><br/>
<b>Bowling style:</b> Right-arm offbreak
</body>
</html>
kohli.html
<html>
<body>
<b>Full name:</b> Virat Kohli<br/><br/>
<b>Born:</b>November 5, 1988, Delhi<br/><br/>
<b>Major teams:</b>India, Delhi, India Red, India Under-19s, Royal Challengers Bangalore<br/><br/>
<b>Playing role:</b>Middle-order batsman<br/><br/>
<b>Batting style:</b>Right-hand bat<br/><br/>
<b>Bowling style:</b>Right-arm medium
</body>
</html>
raina.html
<html>
<body>
<b>Full name:</b> Suresh Kumar Raina<br/><br/>
<b>Born:</b>November 27, 1986, Muradnagar, Ghaziabad, Uttar Pradesh<br/><br/>
<b>Major teams:</b>India, Chennai Super Kings, India Blue, India Under-19s, Indian Board President's XI, Rajasthan Cricket Association President's XI, Uttar Pradesh, Uttar Pradesh Under-16s<br/><br/>
<b>Playing role:</b>Middle-order batsman<br/><br/>
<b>Batting style:</b>Left-hand bat<br/><br/>
<b>Bowling style:</b> Right-arm offbreak
</body>
</html>
yuvi.html
<html>
<body>
<b>Full name:</b>Yuvraj Singh<br/><br/>
<b>Born:</b>December 12, 1981, Chandigarh<br/><br/>
<b>Major teams:</b>India, Asia XI, Kings XI Punjab, Pune Warriors, Punjab, Yorkshire<br/><br/>
<b>Playing role:</b>Middle-order batsman<br/><br/>
<b>Batting style:</b>Left-hand bat<br/><br/>
<b>Bowling style:</b>Slow left-arm orthodox
</body>
</html>
veeru.html
<html>
<body>
<b>Full name:</b>Virender Sehwag<br/><br/>
<b>Born:</b>October 20, 1978, Delhi<br/><br/>
<b>Major teams:</b>India, Asia XI, Delhi, Delhi Daredevils, ICC World XI, India Blue, Leicestershire, Rajasthan Cricket Association President's XI<br/><br/>
<b>Playing role:</b>Top-order batsman<br/><br/>
<b>Batting style:</b>Right-hand bat<br/><br/>
<b>Bowling style:</b>Right-arm offbreak
</body>
</html>
dhoni.html
<html>
<body bgcolor="cyan">
<b>Full name:</b> Mahendra Singh Dhoni<br/><br/>
<b>Born:</b>July 7, 1981, Ranchi, Bihar (now Jharkhand)<br/><br/>
<b>Major teams:</b>India, Asia XI, Bihar, Chennai Super Kings, Jharkhand<br/><br/>
<b>Playing role:</b>Wicketkeeper batsman<br/><br/>
<b>Batting style:</b>Right-hand bat<br/><br/>
<b>Bowling style:</b>Right-arm medium
</body>
</html>IMAGE MAPPING
1) IMAGE MAPPING
india.html
<html>
<head>
<title>Image Mapping....</title>
</head>
<body>
<h1 align="center"><font face="Forte"color="violet">INDIA</font></h1>
<hr>
<p>
<font size="3" face="Comic Sans MS"color="darkblue">
<ul>
<li>The name India is derived from Indus, which is derived from the Old Persian word Hindu, from Sanskrit</li>
<li>India is the seventh-largest country by geographical area</li>
<li>The second-most populous country with over 1.2 billion people</li>
<li>The most populous democracy in the world</li>
<li>Consisting of 28 states and seven union territories</li>
<li>The name India is derived from Indus, which is derived from the Old Persian word Hindu, from Sanskrit</li>
</ul>
<p>
<font size="4" face="Calibri"color="red">
Click On The Hotspots To View More Information About That Particular Places...
</font>
</p>
<map name="indiamap">
<area shape="rect" coords="213,404,223,413" href="chennai.html" alt="Click here to get more details">
<area shape="rect" coords="168,168,182,178" href="delhi.html" alt="Click here to get more details">
<area shape="rect" coords="113,313,126,323" href="mumbai.html" alt="Click here to get more details">
<area shape="rect" coords="358,251,370,261" href="kolkatta.html" alt="Click here to get more details">
</map>
<img src="india.jpg" border=0 usemap="#indiamap">
</body>
</html>
chennai.html
<html>
<Title>Chennai....</title>
<body>
<p><font face="Cambria" color="blue" size="3">Chennai, formerly known as Madras or Madarasapatinam,
is the capital city of the Indian state of Tamil Nadu...</font></p>
<table>
<tr>
<td><img src="Parrys.jpg"><br>
<font face="Cambria" color="blue" size="3">Parry's Corner</td>
<td>
<font face="Cambria" color="blue" size="2">
<ul>
<li>Chennai being the fourth most populous metropolitan area and the fifth most populous city in India</li>
<li>It is also the world's 36th largest metropolitan area</li>
<li>Chennai's economy has a broad industrial base in the automobile, computer, technology, hardware manufacturing, and healthcare industries</li>
<li>The city is India's second largest exporter of software, information technology (IT) and information-technology-enabled services (ITES)</li>
<li>Chennai is a major centre for music, art and culture in India</li>
<li>The city is known for its classical dance shows and Hindu temples</li>
<li>Cricket is the most popular sport in Chennai</li>
<li>Chennai is the base for the large Tamil movie industry, known as Kollywood, home to most of the movie studios</li>
</ul>
</td>
</tr>
</table>
<font face="Cambria" color="blue" size="2">
<a href="india.html">Home</a>
</font>
</body>
</html>
delhi.html
<html>
<Title>Delhi....</title>
<body>
<p><font face="Cambria" color="blue" size="3">Delhi is the eighth largest
metropolis in the world by population with more than 12.25 million people...</font></p>
<table>
<tr>
<td><img src="LotusTemple.jpg"><br>
<font face="Cambria" color="blue" size="3">Lotus Temple</td>
<td>
<font face="Cambria" color="blue" size="2">
<ul>
<li>Which also includes Noida, Greater Noida, Ghaziabad, Gurgaon and Faridabad along with other smaller nearby towns</li>
<li>Delhi has a maximum length of 51.9 km (32 mi) and the maximum width of 48.48 km (30 mi)</li>
<li>The annual mean temperature is 25 °C (77 °F)</li>
<li>The average annual rainfall is approximately 714 mm (28.1 inches)</li>
</ul>
</td>
</tr>
</table>
<font face="Cambria" color="blue" size="2">
<a href="india.html">Home</a>
</font>
</body>
</html>
mumbai.html
<html>
<Title>Mumbai....</title>
<body>
<p><font face="Cambria" color="blue" size="3">It is the most populous city in India, and the second most populous city in the world,
with a population of approximately 14 million...</font></p>
<table>
<tr>
<td><img src="Gateway.jpg"><br>
<font face="Cambria" color="blue" size="3">Gateway Of India</td>
<td>
<font face="Cambria" color="blue" size="2">
<ul>
<li>Mumbai, formerly known as Bombay </li>
<li>Mumbai is the capital of the Indian state of Maharashtra</li>
<li>Mumbai is the commercial and entertainment capital of India</li>
<li>The average annual temperature is 27.2 °C (81.0 °F)</li>
</ul>
</td>
</tr>
</table>
<font face="Cambria" color="blue" size="2">
<a href="india.html">Home</a>
</font>
</body>
</html>
kolkatta.html
<html>
<Title>Kolkata....</title>
<body>
<p><font face="Cambria" color="blue" size="3">Kolkata is the cultural capital of India
and the commercial capital of Eastern India...</font></p>
<table>
<tr>
<td><img src="VictoriaMemorial.jpg"><br>
<font face="Cambria" color="blue" size="3">Victoria Memorial</td>
<td>
<font face="Cambria" color="blue" size="2">
<ul>
<li>Kolkata, formerly known as Calcutta, is the capital of the Indian state of West Bengal</li>
<li>Before 1690 Kolkata, under direct rule of the Nawab of Bengal Siraj-Ud-Daulah</li>
<li>Kolkata is located in the eastern part India</li>
<li>The annual mean temperature is 26.8 °C (80.2 °F)</li>
</ul>
</td>
</tr>
</table>
<font face="Cambria" color="blue" size="2">
<a href="india.html">Home</a>
</font>
</body>
</html>
india.jpg |
Gateway.jpg |
VictoriaMemorial,jpg |
LotusTemple.jpg |
Parrys.jpg |
online examination using jsp
) ONLINE EXAMINATION USING JSP
AIM:
To create a three tier application for conducting online examination using JSP and database.
ALGORITHM:
1. Design the HTML page (ExamClient.html) with the following
a) Create a form to get the input from the user.
b) Use radio buttons to make various options for the questions.
c) Set the URL of the server (ExamServer.jsp) as the value of the action attribute.
d) Use submit button to invoke the server and send the form data to the server.
2. Create the JSP file with the following
a) Read the input from the client.
b) Retrieve the answers from the database.
c) Match the answers from the user with the correct answers from the database table.
d) For each correct answer increment the mark by 5.
e) Server displays the mark and result to the client as a response.
PROGRAM:
ExamClient.html
<html>
<head>
<title>Online Exam Client</title>
<style type="text/css">
body{background-color:black;font-family:courier;color:blue}
</style>
</head>
<body>
<h2 style="text-align:center">ONLINE EXAMINATION</h2>
<h3>Answer the following questions (5 marks for each correct answer)</h3>
<hr/>
<form name="examForm" method="post" action="ExamServer.jsp">
1.Who is called as the father of computer?<br/>
<input type="radio" name="ans1" value="Sachin">Sachin
<input type="radio" name="ans1" value="Stuart">Stuart
<input type="radio" name="ans1" value="Charles Babbage">Charles Babbage
<input type="radio" name="ans1" value="Napier">Napier
<br/><br/>
2.C++ was developed by?<br/>
<input type="radio" name="ans2" value="Dennis Ritchie">Dennis Ritchie
<input type="radio" name="ans2" value="None">None
<input type="radio" name="ans2" value="David Ritchie">David Ritchie
<input type="radio" name="ans2" value="John">John
<br/><br/>
3.C was developed by?<br/>
<input type="radio" name="ans3" value="Dennis Ritchie">Dennis Ritchie
<input type="radio" name="ans3" value="Stroustrup">Stroustrup
<input type="radio" name="ans3" value="David Ritchie">David Ritchie
<input type="radio" name="ans3" value="Charles Babbage">Charles Babbage
<br/><br/>
<input type="submit" value="Check Your Result"/>
</form>
</body>
</html>
ExamServer.jsp
<%@page contentType="text/html" language="java" import="java.sql.*"%>
<html>
<head>
<title>Online Exam Server</title>
<style type="text/css">
body{background-color:black;font-family:courier;color:blue}
</style>
</head>
<body>
<h2 style="text-align:center">ONLINE EXAMINATION</h2>
<p>
<a href="ExamClient.html">Back To Main Page</a>
</p>
<hr/>
<%
String str1=request.getParameter("ans1");
String str2=request.getParameter("ans2");
String str3=request.getParameter("ans3");
int mark=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:examDS");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT * FROM examTab");
int i=1;
while(rs.next())
{
if(i==1)
{
String dbans1=rs.getString(1);
if(str1.equals(dbans1))
{
mark=mark+5;
}
}
if(i==2)
{
String dbans2=rs.getString(1);
if(str2.equals(dbans2))
{
mark=mark+5;
}
}
if(i==3)
{
String dbans3=rs.getString(1);
if(str3.equals(dbans3))
{
mark=mark+5;
}
}
i++;
}
if(mark>=10)
{
out.println("<h4>Your Mark Is : "+mark+"</h4>");
out.println("<h3>Congratulations....! You Are Eligible For The Next Round...</h3>");
}
else
{
out.println("<h4>Your Mark is : "+mark+"</h4>");
out.println("<h3>Sorry....!! You Are Not Eligible For The Next Round...</h3>");
}
%>
</form>
</body>
</html>
Database Name: examDB.accdb
Table Name: examTab
Subscribe to:
Posts (Atom)