Using AJAX to Build a Web Site Indexing Application with Prototype - Going backwards: listing the complete source code that corresponds to the application’s user interface
(Page 2 of 4 )
Before I proceed to using the Prototype JavaScript library to develop the behavioral layer of this application, first I’d like to list the full client-side code that corresponds to its user interface. This was created in the first article of the series. Doing so, it’ll be much easier for you to understand how the set of JavaScript functions that I’m going to define later on fits into the whole development schema.
That being said, here is the full list of CSS styles and (X)HTML markup of this web site indexing system, as it was originally defined in the first tutorial. Take a look at it, please:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-
8859-1" />
<title>Web Site Indexing System using Prototype</title>
<style type="text/css">
body{
padding: 0;
margin: 0;
background: #fff;
}
h1{
width: 550px;
padding: 10px;
background: #ccf;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
font: bold 22px Arial, Helvetica, sans-serif;
color: #000;
text-align: center;
border: 1px solid #999;
}
#sitecontainer{
width: 550px;
height: 400px;
background: #ccf;
padding: 10px;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
border: 1px solid #999;
overflow: auto;
}
#sitecontainer p{
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
color: #000;
}
#sitecontainer a:link,#sitecontainer a:visited{
font: bold 11px Verdana, Arial, Helvetica, sans-serif;
color: #00f;
text-decoration: underline;
}
#sitecontainer a:hover{
color: #c30;
}
#formcontainer{
width: 550px;
height: 300px;
background: #ccf;
padding: 10px;
margin-left: auto;
margin-right: auto;
border: 1px solid #999;
}
#formcontainer p{
text-align: right;
margin-right: 100px;
font: bold 11px Verdana, Arial, Helvetica, sans-serif;
color: #000;
}
.inputbox{
width: 300px;
padding: 2px;
background: #eee;
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
color: #000;
border: 1px solid #999;
}
.submitbox{
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
color: #000;
padding: 2px;
}
textarea{
width: 300px;
height: 150px;
padding: 2px;
background: #eee;
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
color: #000;
border: 1px solid #999;
}
</style>
</head>
<body>
<h1>WEB SITE INDEXING SYSTEM</h1>
<div id="sitecontainer"></div>
<div id="formcontainer">
<form id="siteform">
<p>Your website's URL: <input type="text" id="url"
value="http://" class="inputbox" title="Enter your site's
URL" /></p>
<p>Your website's Title: <input type="text" id="title"
class="inputbox" title="Enter your site's Title" /></p>
<p>Enter a short description for your website below (max.
256 chars.)</p><p><textarea id="description" title="Enter a
description for your site"></textarea></p>
<p><input type="submit" value="Submit Web Site"
class="submitbox" title="Submit Web Site" /></p>"
</form>
</div>
</body>
</html>
All right, that was really easy to grasp, wasn’t it? After all, the above group of CSS styles and the markup simply create the basic front-end of this web site indexing application, in a very friendly fashion. Nonetheless, it’s not my intention here to bore you with irrelevant details on how to create the respective user interface, since this subject was extensively covered in the preceding article.
So, considering that at this moment you may feel pretty curious as to how to use the Prototype library, this is a good time to move on and start defining the set of JavaScript functions responsible for adding new web sites to the pertinent index system and displaying data for the existing ones.
To learn how Prototype’s AJAX capabilities will be used in the context of this application to send out HTTP requests in the background, all you have to do is jump into the following section and keep reading. Don’t worry. I’ll be there, waiting for you.
Next: Submitting and displaying web site data in the background >>
More JavaScript Articles
More By Alejandro Gervasio