Académique Documents
Professionnel Documents
Culture Documents
Recapture
<html>
<head>
<title>Hi ni page yet Lets Try</title>
</head>
<body>
<table width="1006" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="44" colspan="2" valign="top"><div align="center">Please Try this it really works </div></td>
</tr>
<tr>
<td width="285" height="390" valign="top"><p>Put some text here. Paste some more or type </p>
<p><a href="Test Page.html">Link 1</a></p>
<p><a href="Test Page.html">Link 2 </a></p>
<p><a href="Test Page.html">Link 3</a></p>
<p><a href="Test Page.html">Link 4</a></p>
<p><a href="Test Page.html">Link 5</a></p>
<p> </p></td>
<td width="721" valign="top"><p align="justify">The <strong>Internet Server Application Programming
Interface</strong> (<strong>ISAPI</strong>) is an N-tier API of Internet Information Services (IIS),
Microsoft's collection of Windows-based web server services. The most prominent application of IIS and
ISAPI is Microsofts web server.<br/>
The ISAPI has also been implemented by Apache's mod_isapi module so that server-side web
applications written for Microsoft's IIS can be used with Apache, and other third-party web servers like
Zeus Web Server offer ISAPI interfaces.<br />
Microsoft's web server application software is called Internet Information Services, which is made up of
a number of "sub-applications" and is very configurable. ASP.NET is one such slice of IIS,
allowing a programmer to write web applications in his or her choice of programming language (VB.NET,
C#, F#) that's supported by the Microsoft .NET CLR. <strong>ISAPI</strong> is a much lower-level
programming system, giving much better performance, at the expense of simplicity.</p></td>
</tr>
</table>
</body>
</html>
1
CK
4
CK
<?php
$StudentID=$_POST["txtStudentID"];
$StudentName=$_POST["txtStudentName"];
$Course=$_POST["cbocourse"];
$Comments=$_POST["Comments"];
$con=mysql_connect("localhost","root","");
mysql_select_db("TestData",$con);
mysql_query("insert into students(StudentID,StudentName, Course, Comments)
values('$StudentID','$StudentName','$Course','$Comments')");
mysql_close($con);
echo "Data Posted Successfully and Saved Students Table";
?>
6
CK
Scripts may be evaluated as a document loads to modify the contents of the document
dynamically.
Scripts may accompany a form to process input as it is entered. Designers may dynamically
fill out parts of a form based on the values of other fields. They may also ensure that input
data conforms to predetermined ranges of values, that fields are mutually consistent, etc.
Scripts may be triggered by events that affect the document, such as loading, unloading,
element focus, mouse movement, etc.
Scripts may be linked to form controls (e.g., buttons) to produce graphical user interface
elements.
There are two types of scripts authors may attach to an HTML document:
Those that are executed one time when the document is loaded by the user agent. Scripts
that appear within a SCRIPT element are executed when the document is loaded. For user
agents that cannot or will not handle scripts, authors may include alternate content via the
NOSCRIPT element.
Those that are executed every time a specific event occurs. These scripts may be assigned
to a number of elements via the intrinsic event attributes.
i.
ii.
Alerts - This is an event based sequence where something has happened causing the
alert message to pop up. For example the file can be scripted to make this pop up when
a webpage is opened saying something along the lines of 'Welcome!'
7
CK
iii.
iv.
Redirecting the user - This is a simple use for scripting languages. For example if a page
no longer exists, the user can be redirected from that page to another fully functioning
one.
Browser Detection - The navigator object determines which platform a scripting
language will be working with, using browser detection is very necessary considering
there are old browsers out there which will not be the same as some of the newer
ones. Using this can make the information displayed appropriate for the user.
Maintaining cookies - Cookies are what remember little sets of data so that when you
visit a site it remembers for example what you put in the box for your first name on a
registration field. By telling the scripting language to do this you can set it to last for
however long you want, a few days, a few months, or just until the page is exited by
leaving the space blank.
Introducing JavaScript
JavaScript was developed by Netscape Communications Corporation, the maker of the Netscape
web browser. JavaScript was the first web scripting language to be supported by browsers, and it
is still by far the most popular.
JavaScript was originally called LiveScript and was first introduced in Netscape Navigator 2.0 in
1995. Netscape Navigator was an early browser that held a large share of the browser market.
Animate images or create images that change when you move the mouse over them.
Create ad banners that interact with the user, rather than simply displaying a graphic.
Detect the browser in use or its features and perform advanced functions only on browsers
that support them.
Detect installed plug-ins and notify the user if a plug-in is required.
Modify all or part of a web page without requiring the user to reload it.
Display or interact with data retrieved from a remote server.
Browsers
If you are developing a web application using a client-side scripting language then you will need to
ensure cross compatibility amongst browser. A browser is where the script will run. As browser
are constantly being updated, so too are the version of scripting language that is run inside them.
Common scripting languages that run inside browsers are
JavaScript and VBscript, the online materials you are reading will focus on Javascript
as this language is available across a variety of browsers.
VBscript is developed by Microsoft and is available only on the Internet Explorer
browsers.
9
CK
Also, interpreted languages are generally portable across various hardware and network platforms
and scripts can be embedded in standard text documents for added functionality.
Unlike a compiler, an interpreter checks syntax and generates object code one source line at a
time. Think of this as very similar to a group of translators at a United Nations' Conference, who
each have to convert sentences spoken by delegates into the native language of their
representative.
When an error is encountered, the interpreter immediately feeds back information on the type of
error and stops interpreting the code. This allows the programmer to see instantly the nature of
the error and where it has occurred. He or she can then make the necessary changes to the source
code and have it re-interpreted.
As the interpreter executes each line of code at a time the programmer is able to see the results
of their programs immediately which can also help with debugging.
Disadvantages
usually run quite slowly
Limited access to low level and speed optimization code.
Limited commands to run detailed operations on graphics.
11
CK
For iCountvar = To 20
iSum = iSum + iCountvar
Pic.Display iSum
Next iCountvar
This has implications for error reporting, eg: when an interpreter encounters an error it
reports it to the user immediately and halts further execution of the program. Such instant
feedback, pinpointing the exact location of the error, helps the programmer to find and
remove errors.
Compilers, on the other hand, analyze the entire program, taking note of where errors
have occurred, and places these in an error/diagnostic file. If errors have occurred then
the program cannot run. Programmers must then use the error messages to identify and
remove the errors in the source code. Some compilers assist by adding line numbers to the
source listing to help pinpoint errors and all compilers will describe the nature of the error
e.g. missing semi-colon, expected keyword, etc. - although interpreting some compiler
diagnostics is a skill in itself.
12
CK
iii.
iv.
Of course, the problem with the above model is that it does not exactly tell the whole story.
Actually, though Web Servers are built to talk to Web Browsers, they are not built to talk to
Databases. Thus, in order for the Web Server to talk to a Database, it requires a helper (sometimes
called Middle Ware).
The most basic type of Middle Ware is a CGI script that is written to translate requests from the
Web Server to a format that the Database can understand, and to translate Database responses
14
CK
15
CK
The major disadvantage of scripting languages is that executable code can inadvertently be
downloaded from a remote server to a web browser's machine, installed and run using the local
browser's interpreter. This is easily done by visiting dubious web sites or downloading programs
without valid authenticity. The user is probably unaware of anything devious occurring.
This is a weakness and major drawback in the formal rules defining scripting languages like
JavaScript and VBScript.
16
CK
3. Validating the content of fields: When filling in forms, each field, especially required fields
denoted by an asterisk, are validated for correct input. If the field is left blank or incorrect
information entered then a user message will be generated and you may not continue.
<html>
17
CK
Embedding Script
JavaScript statements are hidden in HTML comments to prevent incorrect interpretation by
older browsers that do not recognize JAVA script. An example HTML document with embedded
JAVA script is shown below.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>An Example of JavaScript code</title>
<head>
<body>
<script language="JavaScript">
<!-- Use the HTML comment to hide JavaScript from old browsers
document.write("This text was written using JavaScript.")
// End hiding JavaScript -->
</script>
<NOSCRIPT>
You see this if your browser won't run JavaScript.
</NOSCRIPT>
</body>
</html>
19
CK
SCRIPT - The area between the <SCRIPT> and the </SCRIPT> tags defines the script
program.
Language - Defines the script language. Choices are JavaScript and VBScript.
SRC - Defines an external file containing the source code of the JavaScript. It may
be a URL with the complete path to the script which may reside at another
website. An example is:
<script language="JavaScript" SRC="testscript.js">
ii.
NOSCRIPT - The area between the <NOSCRIPT> and the </NOSCRIPT> tag is run by
browsers that can't run JAVA script or have the feature turned off.
Comments are started with "//" for a single line, along with the "/*" to start a comment and
"*/" to end a comment for multiple lines. The comments work the same as in C++.
In JAVA, a variable must be defined before it is used, therefore it is a common practice to
place JavaScript definitions in the header section of an HTML file. The example below will
randomly select and display a greeting in an HTML header of size three.
<HTML>
<HEAD>
<TITLE>Common JavaScript definition practice</TITLE>
<SCRIPT language="JavaScript">
20
CK
\b - backspace
\f - Form feed
\n - New line
\r - Carriage return
\t - Tab
JavaScript Operators
Math
Operator
Meaning
Addition
Subtraction
Multiplication
Division
Modulus
++
Increment
Decrement
Negation
Meaning
&
AND
NOT
OR
exclusive OR
<<
Left shift
>>
Right shift
>>>
Logical Operators
Logical operators operate on boolean values which are either true or false.
Operator
Meaning
&&
AND
||
OR
NOT
Conditional
,
Comma
The syntax for the conditional operator is:
if
if (value == 3)
{
document.write("Value is three")
}
22
CK
While
var i = 0
while (i < 3)
{
i++
}
Do While
The example prints the days of the week.
days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var day = 0
do
{
document.write(days[day] + " is day " + eval(day+1) + " of the week.<BR>\n")
day++
} while (day < 7)
For
The following example will determine what numeric day of the week Wednesday falls on.
days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var day = "Wednesday"
var place
for (i = 0;i < days.length;i++)
{
if (day == days[i])
{
place = i + 1
}
}
document.write(day + " is day " + place + " in the week.<BR>\n")
23
CK
Break
The break statement may be used to break out of a while, if, switch, dowhile, or for statement.
The break causes program control to fall to the statement following the iterative statement. The
break statement now supports a label which allows the specification of a location for the program
control to jump to. The following code will print "Wednesday is day 4 in the week".
days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
24
CK
JavaScript Functions
Defining Functions
JavaScript functions are defined using the key word "function" followed by its name and
variables being passed to it in the following syntax:
function fname(value1,value2, ...)
{
statement1
statement2
.
}
An example:
<HTML>
<HEAD>
<TITLE>A function definition</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hiding JavaScript
26
CK
Calling Functions
If evaluate() is a defined function, the following line will call the function:
<SCRIPT LANGUAGE="JavaScript">
<!-i3 = evaluate (Tree)
// -->
</SCRIPT>
This function may evaluate the members of the array tree to see how many match a certain
criteria.
Another way to call a function is to tie it to an anchor:
<A HREF="javascript:redirectLink()">redirecting</A>
Another way is to tie it to an event:
<A NAME="javatest" onClick="redirectLink()">redirecting</A>
27
CK
Arguments - An array of arguments passed to the function. This is an array object which
has a property of length which enables the programmer to tell how many arguments (or
variables) are passed to the function.
Caller - The name of the function that called the function.
Prototype - Used to make more properties.
First Name:
Last Name:
Address1:
31
CK
Zip:
Area Code/Phone:
The Script
This is placed in the HTML header:
<SCRIPT SCRIPT FOR="cmdSubmit" EVENT="onclick" LANGUAGE="JavaScript">
<!-var TheForm;
TheForm = document.RegistrationForm;
if (TheForm.firstname.value.length == 0) {
alert("Please enter your first name.");
TheForm.firstname.focus();
}
else if (TheForm.lastname.value.length == 0) {
TheForm.lastname.value = prompt("Please enter your last name.");
if (TheForm.lastname.value.length != 0)
TheForm.addr1.focus();
}
else if (TheForm.addr1.value.length == 0) {
alert("Please enter your address.");
TheForm.addr1.focus();
}
else if (TheForm.city.value.length == 0) {
alert("Please enter the city.");
TheForm.city.focus();
32
CK
33
CK