Beruflich Dokumente
Kultur Dokumente
Function
HREF
Points to the URL of the other
document.
REL Defines the relationship between the
current document and persons who have
contributed to its existence.
REV Defines the relationship between another
HTML document and the current document.
TYPE
Specifies the type and parameters for a
linked style sheet.
<HTML>
<HEAD>
<TITLE>Using the Satellite Identification and Tracking
System (SITS)</TITLE>
<LINK REV="made" HREF="mailto: rmeegan@ia.net">
<LINK REL="toc" HREF="contents.htm">
<LINK REL="index" HREF="index.htm">
<LINK REL="copyright" HREF="copyright.htm">
<META NAME="Description" CONTENT="An on-line
manual for the SITS">
</HEAD>
<BODY>
</BODY>
</HTML>
URL
CONTENT
Function
defines the property for the
element.
Provides an additional description
of the element. If this attribute is
missing, it is assumed to be the
same as HTTP-EQUIV.
Defines a target document for the
property.
Provides the response value for the
property.
<HTML>
<HEAD>
<TITLE>General Officers of the US Army in the
Civil War</TITLE>
<META NAME="Keywords" CONTENT="Yankee,
Grand Army of the Republic,
War Between the States">
<META NAME="Description" CONTENT="A listing
of the general officers of the US
Army in the Civil WAR">
</HEAD>
<BODY BGCOLOR="NAVY" TEXT="WHITE"
LINK="RED" VLINK="BLUE" ALINK="GREEN">
</BODY>
</HTML>
Color Definitions
Colors are defined in HTML using a hexadecimal
coding system.
16 Standard Colors and Their Value:
Color
Value
Black
#000000
Maroon
#800000
Green
#008000
Olive
#808000
Navy
#000080
Purple
#800080
Teal
Gray
Silver
Red
Lime
Yellow
Blue
Fuchsia
Aqua
White
#008080
#808080
#C0C0C0
#FF0000
#00FF00
#FFFF00
#0000FF
#FF00FF
#00FFFF
#FFFFFF
Attribute Function
LEFT
Aligns the text with the left margin
of the viewer. The right edge is
ragged.
CENTER Centers the text between the
viewer margins.
RIGHT Aligns the text with the right
margin of the viewer. The left
edge is ragged.
<HR>
<H2 ALIGN=LEFT>American</H2>
Mercury<BR>
Gemini<BR>
Apollo<BR>
Shuttle<BR>
<HR >
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Font Selection Example</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana", "Arial", "Helvetica">
This is an example of font selection. </FONT>
</BODY>
</HTML>
Symbols
, #,
,
1/2 , 1/3, 3 /4
[Pi]
<>
&
[dagger]
Description
Aligns the text with the top of the image
Aligns the text with the middle of the image
Aligns the text with the bottom of the image
Displays image on left side and
surrounding content flows around the image
Displays image on the right side of the
window and surrounding content flows around
the image
Internal Links
First, you must create an anchor in the HTML file
that indicates the location to which you're linking.
<A NAME=MIDDLE>Middle Section in Web
Page</A>
Second, Instead of setting the HREF attribute to
the URL of another Web page, set it to the
anchor's name, prefixing the anchor's name with
a pound sign (#).
<A HREF="#MIDDLE">Jump to the middle</A>
Description
Renders the list in a more compact form
Sets markers to uppercase letters
Sets markers to lowercase letters
Sets markers to uppercase Roman numerals
Sets markers to lowercase Roman numerals
Sets markers to numbers
Sets beginning value of item markers in the
current list
<HTML>
<HEAD>
<TITLE>Basic Table Examples</TITLE>
</HEAD>
<BODY>
<TABLE BORDER>
<TR>
<TH>Colors</TH><TH>Of</TH><TH>The Rainbow</TH>
<TR>
<TD>Red</TD><TD>Orange</TD><TD>Yellow</TD>
</TR>
<TR>
<TD>Green</TD><TD>Blue</TD><TD>Violet</TD>
</TR>
</TABLE>
<HR>
<TABLE BORDER>
<CAPTION>My Favorite Groups</CAPTION>
<TR><TH>Rock</TH>
<TD>Pink Floyd</TD>
<TD>Led Zepplin</TD>
<TD>The Dobbie Brothers</TD>
</TR>
<TR><TH>Soft</TH>
<TD>Simon and Garfunkel</TD>
<TD>Peter, Paul, & Mary</TD>
<TD>Neil Young</TD>
</TR>
<TR><TH>New Age</TH><TD>Enya</TD>
<TD>Clannad</TD>
<TD>Steamroller</TD>
</TR>
</TABLE>
</BODY>
</HTML>
No rules
Horizontal rule between all row groups and a
vertical rule between all column groups
GROUPS rulings, plus horizontal rules
between all rows
GROUPS rulings, plus vertical rules between
all columns
Rules between all rows and all columns
<HTML>
<HEAD>
<TITLE>Table Borders</TITLE>
</HEAD>
<BODY>
<TABLE BORDER>
<TR><TH>FRUITS</TH><TH>VEGETABLES</TH><TH>WHOLE
GRAINS</TH></TR>
<TR><TD>Apple</TD><TD>Broccoli</TD><TD>Barley</TD></TR>
<TR><TD>Orange</TD><TD>Cauliflower</TD><TD>Weat
Berries</TD></TR>
<TR><TD>Kiwi</TD><TD>Sugar Snap
Pea</TD><TD>Millet</TD></TR>
<TR><TD>Pineapple</TD><TD>Bell
pepper</TD><TD>Quinoa</TD></TR>
</TABLE>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Table Borders</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD><IMG SRC="lion.gif"></TD>
<TD>
The rampant lion is a symbol from Scottish heraldy. It symbolizes
a duty and willingness to defend one's ideals and values, such as
aretê. The color of the lion, White, is for the purity of the
brotherhood of PEZ, void of the negativity associated with some
fraternities. This White symbolizes how PEZ is a practice of the
pure theory of brotherhood. This brotherhood has its roots in common
ties and support rather than hazing and the like.
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Row and Column Spanning</TITLE>
</HEAD>
<BODY>
<TABLE BORDER>
<TR><TH COLSPAN=3>DC nationals</TH><TR>
<TR><TH>Offense</TH><TH>Defense</TH><TH>Goalie</TH></TR>
<TR>
<TD>Husmann</TD><TD>O'Donnell</TD><TD ROWSPAN=5>Weinberg</TD>
</TR>
<TR>
<TD COLSPAN=2>Popplewell</TD>
</TR>
<TR>
<TD>McGilly</TD><TD>Longo</TD>
</TR>
<TR>
<TD>Donahue</TD><TD>Seymour</TD>
</TR>
<TR>
<TD>Camillo</TD><TD>Walsh</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Foramtting Example</TITLE>
<HEAD>
<BODY>
<TABLE BORDER BORDERCOLOR=BLUE BGCOLOR=WHITE>
<TR><TD>1-one</TD><TD>2-two</TD><TD>3-three</TD></TR>
<TR><TD>4-four</TD><TD>5-five</TD><TD>6-six</TD></TR>
</TABLE>
Changing the entire table's color
<HR>
<TABLE BORDER>
<TR BORDERCOLOR=GREEN BGCOLOR=WHITE><TD>1-one</TD>
<TD>2-two</TD><TD>3-three</TD></TR>
<TR><TD>4-four</TD><TD>5-five</TD><TD>6-six</TD></TR>
</TABLE>
Changing a single row's color
<HR>
<TABLE BORDER>
<TR><TD BORDERCOLOR=RED BGCOLOR=YELLOW>1-one</TD><TD>2-two</TD>
<TD>3-three</TD></TR>
<TR><TD>4-four</TD><TD>5-five</TD><TD>6-six</TD></TR>
</TABLE>
Changing a single cell's color
</BODY>
</HTML>
A simple Frame
<HTML>
<HEAD>
</HEAD>
<FRAMESET COLS="*, 2*">
<FRAME SRC="label.htm">
<FRAME SRC="info.htm">
</FRAMESET>
</HTML>
Frame Scrollbars
<FRAME SCROLLING="yes|no|auto">
Frame Resizing
<FRAME NORESIZE>
Frame Borders
You use the BORDER, FRAMEBORDER,
and BORDERCOLOR attributes to set the
look and feel of the borders for your
frameset.
The BORDER attribute is used only with
the <FRAMESET> tag.
It is assigned a value in pixels,
like this:
<FRAMESET BORDER="5">
Targeted Hyperlinks
Naming and Targeting Frames
The NAME attribute assigns a name to a frame
that can be used to link to the frame, for eg.
<FORM>
The <FORM> tag comes at the beginning
of any form.
When you create a <FORM> tag, you also
define the script it uses and how it sends
data using the ACTION and METHOD
attributes:
<FORM METHOD="POST"
ACTION="/cgi-bin/comment_script">
...
</FORM>
ACTION
This attribute points the form to an URL that will
accept the form's information and do something
with it.
If you don't specify an ACTION, it sends the
information back to the same URL the page
came from.
METHOD
This attribute tells the form how to send its
information back to the script. The most
common method is POST, which sends all the
information from the form separately from the
URL. The other option for METHOD is GET,
which attaches the information from the form to
the end of the URL.
Example:
<HTML>
<HEAD>
<TITLE>TEXTAREA.HTM</TITLE>
</HEAD>
<BODY>
<FORM>
<TEXTAREA NAME="comments" ROWS=4
COLS=40>Default text
1 2 3 ...
</TEXTAREA>
</FORM>
</BODY>
</HTML>
MULTIPLE
This allows multiple selections. If you specify multiple,
a scrolling window displays--regardless of the number of
choices or the setting of SIZE.
Example of Selection:
<HTML>
<HEAD>
<TITLE>SELECT1.HTM</TITLE>
</HEAD>
<BODY>
What type of connection:
<FORM>
<SELECT NAME="network">
<OPTION SELECTED VALUE="ethernet"> Ethernet
<OPTION VALUE="token16"> Token Ring - 16MB
<OPTION VALUE="token4"> Token Ring - 4MB
<OPTION VALUE="localtalk"> LocalTalk
</SELECT>
</FORM>
</BODY>
</HTML>
<INPUT>
<INPUT>, unlike <TEXTAREA> and
<SELECT>, is a single tag option for
gathering information.
<INPUT> contains all of the other options
for acquiring information, including simple
text fields, password fields, radio buttons,
check boxes, and the buttons to submit
and reset the form.
VALUE
For a text or password field, it defines the
default text displayed. For a check box or radio
button, it specifies the value that is returned to
the server if the box or button is selected. For
the Submit and Reset buttons, it defines the text
inside the button.
CHECKED
This sets a check box or radio button to on. It
has no meaning for any other type of <INPUT>
tag.
TYPE
This sets the type of input field you want to
display.
<HTML>
<HEAD>
<TITLE>INPUT2.HTM</TITLE>
</HEAD>
<BODY>
<FORM>
Enter the secret word: <INPUT TYPE="password"
NAME="secret_word"
Size="30" MAXLENGTH="30">
</FORM>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>CHECKBOX.HTM</TITLE>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="checkbox" NAME="checkbox1"
VALUE="checkbox_value1"> A checkbox
<INPUT TYPE="checkbox" NAME="checkbox2"
VALUE="checkbox_value2 CHECKED>A pre-selected checkbox
</FORM>
</BODY>
</HTML>
Cont..
<TR><TD></TD><TD><INPUT TYPE="text" NAME="street2"
SIZE="30"></TD></TR>
<TR><TD>City:</TD><TD><INPUT TYPE="text" NAME="city"
SIZE="50"></TD></TR>
<TR><TD>State:</TD><TD><INPUT TYPE="text"
NAME="state"
SIZE="2"></TD></TR>
<TR><TD>Zip:</TD><TD><INPUT TYPE="text" NAME="zip"
SIZE="10"></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTML>
Cont..
<DL>
<DT>Credit Card
<DD><INPUT NAME="pay" TYPE="radio" VALUE="mc">Mastercard
<DD><INPUT NAME="pay" TYPE="radio" VALUE="visa">Visa
<DD><INPUT NAME="pay" TYPE="radio" VALUE="disc">Discover
<DD><INPUT NAME="pay" TYPE="radio"
VALUE="ae">American Express
</DL>
</DL>
</FORM>
</BODY>
</HTML>
<BUTTON ONCLICK="script.scp">
<IMG SRC="ButtonImage.gif">
Click this button to do something great!
</BUTTON>
What is JavaScript?
Javascript is an easy-to-use scripting
language that can be embedded in the
header of your web pages.
It can enhance the dynamics and
interactive features of your page by
allowing you to perform calculations, check
forms, write interactive games, add special
effects, customize graphics selections,
create security passwords and more.
Tag positions
Where do these tags go within a
document?
Anywhere theyre needed in the document.
Sometimes it makes sense to include the
tags nested within the <HEAD>...</HEAD>
tag set;
other times it is essential that the script be
dropped into a very specific location in the
<BODY>...</BODY> section.
Variables
The most convenient way to work with
data in a script is to first assign the data to
what is called a variable.
Its usually easier to think of a variable as
a basket that holds information.
Creating a variable
Use the var keyword, followed by the name
you want to give that variable.
Ex:
var age
or
var age=25
or
var age
age=25
Example 1:
<HTML>
<HEAD>
<TITLE>A Document</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var empid=10
var empname="Ganesha"
var bonus=12675.80
var salary=12000
document.write(Employee id="+empid)
document.write("<br>Employee Name="+empname)
document.write("<br>Employee Bonus="+bonus)
document.write("<br>Annual salary="+salary*12)
document.write("<br>Adding all 3="+empid+empname+bonus)
</SCRIPT>
</HEAD><body>
</BODY>
</HTML>
//result = "2500"
//result = 4
Arithmetic Operators:
The standard math operators for addition,
subtraction, multiplication, and division (+, -, *, /)
are built into JavaScript.
Comparison operators
Another category of operator helps you
compare values in scripts whether two values
are the same, for example.
These kinds of comparisons return a value of
the Boolean type true or false.
Symbol
==
!=
>
>=
<
<=
Description
Equals
Does not equal
Is greater than
Is greater than or equal to
Is less than
Is less than or equal to
Control Structures
If constructions
if (condition) {
statement[s] if true
}
For eg:
if (yourAge < 18) {
alert(Sorry, you cannot vote.)
}
If . . . else constructions
The formal syntax definition for an if...else
construction is as follows:
if (condition) {
statement[s] if true
}
else {
statement[s] if false
}
For Eg:
var febDays = 0
var theYear = 1993
if (theYear % 4 == 0) {
febDays = 29
}
else {
febDays = 28
}
Functions
A function is a definition of a set of
deferred actions.
Functions are invoked by event handlers
or by statements elsewhere in the script.
Whenever possible, good functions are
designed to be reusable in other
documents.
A function is capable of returning a value
to the statement that invoked it, but this is
not a requirement.
<BODY>
<SCRIPT>
document.write("Half the number of 10.6
is: ", getHalf(10.6),"<BR>");
document.write("Half the number of 12.3
is: ", getHalf(12.3));
</SCRIPT>
<P> Done.
</BODY>
</HTML>
<html>
<head><title> Example Window</title>
<script language="JavaScript">
function calc(){
var intVal=parseInt(myform.mytext.value);
sum=0;
for(i=1;i<=intVal;i++){
sum=sum+i;
}
document.write("Sum ="+sum);
}
</script>
</head>
<body>
<hr>
<form name="myform">
<p>
Enter any no.
<input type="text" name="mytext" size="10">
</p>
<input type="button" value="click here"
onClick="calc()">
</form>
<hr>
</body>
</html>
Arrays
The JavaScript array is one of the most useful
data constructions available to you.
The structure of a basic array resembles that of a
single-column spreadsheet.
Each row of the column holds a distinct piece of
data, and each row is numbered.
Numbers assigned to rows are in strict numerical
sequence, starting with zero as the first row.
This row number is called an index. To access an
item in an array, you need to know the name of
the array and the index for the row.
Creating an Array
var USStates = new Array (51)
USStates - name of the variable
new - keyword
Array(51)- how many elements eventually will
occupy the memory.
The first row of the USStates array is
addressed as USStates[0]
Example 1
<HEAD>
<TITLE> Array Program </TITLE>
<SCRIPT LANGUAGE=JavaScript">
var a=new Array(3);
a[0]=12;
a[1]="Raju";
a[2]=7.2;
for(i=0;i<3;i++)
{
document.write(a[i]+"<BR>");
}
</SCRIPT></HEAD>
Example 2
<script language="JavaScript">
function go(t)
{
sum =0;
for(i=0;i<t.length;i++)
sum += t[i];
return sum;
}
Contd..
var arr1 = new Array (12,4,22,50);
var arr2 = new Array (45,2);
var arr3 = new Array (2);
document.write("<br>Sum of arr1 = " + go(arr1));
document.write("<br>Sum of arr2 = " + go(arr2));
document.write("<br>Sum of arr3 = " + go(arr3));
</script>
output:
Sum of arr1 = 88
Sum of arr2 = 47
Sum of arr3 = NaN
//Not a Number
output:
Length =4
Test
4
2.2
50p
_____________
Length =2
45
F2
______________
Length =2
undefined
undefined
______________
Length =4
243
4
2.2
50p
Associative array
For the case where the element is a string,
boolean, or non-integer numeric, you can
associate another variable or object with
that element and access that new variable
or object using the name of the original
array and the value stored in the element.
Associative array
<script language="JavaScript">
my = new Array("Name","Age","Sal");
my["Name"] = "Rama";
my["Age"] = 18;
my["Sal"] = 12455.45;
document.write("<br>Name =" +my["Name"]);
document.write("<br>Age =" +(my["Age"]+3));
document.write("<br>Salary=" +(my["Sal"]+100));
document.write("<br>Token =" +(my[1]));
</script>
output:
Name =Rama
Age =21
Salary=12555.45
Token =Age
Output
Display myArray
Element 0 = Tom
Element 1 = Dick
Element 2 = Harry
Element 3 = Sue
Sort and display the array
Element 0 = Dick
Element 1 = Harry
Element 2 = Sue
Element 3 = Tom
Done.
Methods
Most objects have a certain collection of things that they
can do. Different objects can do different things, just as a
door can open and close, while a light can turn on and
off. A new document is opened with the method
document.open() You can write "Hello World" into a
document by typing document.write("Hello World") .
open() and write() are both methods of the object:
document.
For example:
document.bgcolor="red" is a property because I'm
changing the existing details about the document.
alert("Hello There") is a method because it creates
something new, an alert box.
Events
Events are how we trigger our functions to
run. The easiest example is a button,
whose definition includes the words
onClick="run_my_function()". The onClick
event, as its name implies, will run the
function when the user clicks on the
button. Other events include
OnMouseOver, OnMouseOut, OnFocus,
OnBlur, OnLoad, and OnUnload.
EVENTS IN A FORM
There are 3 events which are particularly
useful when working in a form.
onFocus
onBlur
onChange
<FORM>
<INPUT TYPE=TEXT SIZE=20
onFocus="window.status='Hi there';return true">
</FORM>
<FORM>
<INPUT TYPE=TEXT SIZE=20
onBlur="window.status='Bye now';return true">
</FORM>
On Change Example 1
<SCRIPT>
function getSelect(s) {
return s.options[s.selectedIndex].value
}
</SCRIPT>
<FORM>
<SELECT NAME="mylist" SIZE=1
OnChange="location=getSelect(this)">
<OPTION value="#"> Choose a search engine
<OPTION value="http://www.yahoo.com"> Yahoo
<OPTION value="http://www.lycos.com"> Lycos
<OPTION value="http://www.excite.com"> Excite
</SELECT>
<FORM>
On Change Example 2
<html>
<body>
<SCRIPT>
function getSelect(s) {
document.write(s.selectedIndex+"<br>"+s.options[s.selectedIndex].value);
}
</SCRIPT>
<FORM>
<SELECT NAME="list" SIZE=1 onChange=getSelect(this)>
<OPTION value="#"> Choose a search engine
<OPTION value="http://www.yahoo.com"> Yahoo
<OPTION value="http://www.lycos.com"> Lycos
<OPTION value="http://www.excite.com"> Excite
</SELECT>
</FORM>
</body>
</html>
becomes
self.propertyName
self.methodName([parameters])
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" VALUE="Create Window"
onClick="makeNewWindow()">
<INPUT TYPE="button" VALUE="Close Window"
onClick="closeNewWindow()">
</FORM>
</BODY>
</HTML>
window.status property
<HTML><HEAD><TITLE>window.defaultStatus
property</TITLE>
<SCRIPT LANGUAGE="JavaScript">
window.defaultStatus = "Welcome to my Web site."
</SCRIPT>
</HEAD>
<BODY><A HREF="http://home.netscape.com"
onMouseOver="window.status = 'Go to your browser Home
page.(www.igiindia.com)';return true"
onMouseOut="window.status='';return true">Home</A><P>
<A HREF="http://home.netscape.com"
onMouseOver="window.status = 'Visit Netscape\'s Home
page.(home.netscape.com)';return true"
onMouseOut="window.status = window.defaultStatus; return
true">Netscape</A>
</BODY></HTML>
<html>
<head>
<script language="JavaScript">
function pwd( )
{
Ret=prompt('Type Password',"");
if(Ret == xiss")
conf( )
else
alert("Wrong Password.");
}
function conf( )
{
if (confirm('Wish to open another document ?'))
location=test.html";
}
</script>
</head>
<body onload=pwd( )>
<input type="button" name="Click" value="Click Me"
onClick=pwd()>
</body>
</html>
form.elements[] property
In addition to keeping track of each type of
element inside a form, the browser also
maintains a list of all elements within a
form.
This list is another array, with items listed
according to the order in which their HTML
tags appear in the source code.
Text Objects
<HTML>
<HEAD>
<TITLE> Text Object value property </TITLE>
<SCRIPT LANGUAGE="javascript">
function upperMe( ){
var field = document.forms[0].converter
field.value = field.value.toUpperCase( )
}
function uppMe( ){
var field = document.forms[0].convert
field.value = field.value.toUpperCase( )
}
</SCRIPT>
</HEAD>
<BODY>
<FORM onSubmit = "return false">
<INPUT TYPE = "text" NAME = "convert" VALUE =
"sample" onBlur = "uppMe( )"><p>
<INPUT TYPE = "text" NAME = "converter" VALUE
= "sample" onKeyUp = "upperMe( )">
</FORM>
</BODY>
</HTML>
Example
<TITLE>Checkbox Inspector</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function inspectBox() {
if (document.forms[0].checkThis.checked) {
alert("The box is checked.")
} else {
alert("The box is not checked at the moment.")
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="checkbox" NAME="checkThis">Check
here<BR>
<INPUT TYPE="button" VALUE="Inspect Box"
onClick="inspectBox()">
</FORM>
</BODY>
</HTML>
Example
<HTML>
<HEAD>
<TITLE>Extracting Highlighted Radio Button</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function fullName() {
var form = document.forms[0]
for (var i = 0; i < form.place.length; i++) {
if (form.place[i].checked) {
break
}
}
alert( form.place[i].value + ".")
}
Contd..
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<B>Select your favorite City:</B>
<INPUT TYPE="radio" NAME="place" VALUE="IT capital of India"
CHECKED>Blore
<INPUT TYPE="radio" NAME="place" VALUE="Capital of India" >New
Delhi
<INPUT TYPE="radio" NAME="place" VALUE="Famous for Howrah
Bridge" >Calcutta<BR>
<INPUT TYPE="button" NAME="Viewer" VALUE="View Details..."
onClick="fullName( )">
</FORM>
</BODY>
</HTML>
Example
<HTML>
<HEAD>
<TITLE>Validator</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function checkForm(form) {
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].value == "") {
alert("Fill out ALL fields.")
return false
}
}
return true
}
Contd..
</SCRIPT>
</HEAD>
<BODY>
<FORM onSubmit="return checkForm(this)">
Please enter all requested information:<BR>
First Name:<INPUT TYPE="text" NAME="firstName" ><BR>
Last Name:<INPUT TYPE="text" NAME="lastName" ><BR>
Password:<INPUT TYPE="password" NAME="passwd" ><BR>
Serial Number:<INPUT TYPE="text" NAME="serialNumber" ><BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
Methods:
var result = string . methodname( )
Ex: var result = string.toUpperCase( )
var result = string.toLowerCase( )
String searches:
string.indexOf( ) - to determine whether one string
is contained in another.
<script>
var str = "Windows".indexOf("d");
document.write(str);
</script>
output : 3
Contd.
</HEAD>
<BODY bgcolor="beige">
<FORM name="form1">
Type your word <INPUT NAME="input" TYPE=Text>
<INPUT TYPE=Button VALUE="submit"
onClick="encode(this.form.input.value)">
Result:<td><INPUT NAME="result" TYPE=Text>
</FORM>
</BODY>
</HTML>
Math Object
Math . PI
Math . SQRT2
Math . max( )
Math . pow( )
Math . round( )
Math . random( )
<script>
var piValue = Math.PI
var a=10,b=20;
document.write(piValue);
// o/p: 3.141592653589793
var rootOfTwo=Math.SQRT2
document.write("<br>"+rootOfTwo);
// o/p : 1.4142135623730951
var a=10,b=20;
var largest = Math.max(a,b);
document.write("<br>",largest); // o/p : 20
var raisedto = Math.pow(a,3);
document.write("<br>",raisedto);// o/p : 1000
var roundto = Math.round(45.4);
document.write("<br>",roundto); // o/p : 45
var roundto = Math.round(45.5);
document.write("<br>",roundto); // o/p : 46
var randno = Math.random( );
document.write("<br>",randno) // o/p : 0.02253180459640247
</script>
if (a==0)
alert(This is not a quadratic equation. Type a non zero
value for A);
else {
var d=Math.sqrt(b*b-4*a*c);
if(d>0||d==0)
{
var r1=(-b+d)/(2*a);
var r2=(-b-d)/(2*a);
alert(The roots are +r1+ & +r2);
} else
alert(The roots are imaginary);} }
</script></head>
<body>
<form bgcolor=blue>
<h2>Quadratic Equation</h2>
<pre><br> <hr>
Enter the coefficients<br>
Value of A<Input type=text name=a value=0
onkeypress=check(this.form)>
Value of B<Input type=text name=b value=0
onkeypress=check(this.form)>
Value of C<Input type=text name=c value=0
onkeypress=check(this.form)> <br>
<input type=button value=Solve onclick=calcroot(this.form)>
</form><br></pre></body></html>
<HTML>
<HEAD>
<TITLE>Image Object</TITLE>
<SCRIPT LANGUAGE="JavaScript1.1">
var newIndex = 1
function checkTimer() {
document.thumbnail2.src = "moon0"+newIndex+".ico"
newIndex++;
if(newIndex==8)
newIndex=1
var timeoutID = setTimeout("checkTimer()",100)
}
</SCRIPT>
</HEAD>
<BODY onLoad=checkTimer()>
<H2>Image Object Demonstration</H2>
<IMG SRC="moon01.ico" NAME="thumbnail2"
HEIGHT=90 WIDTH=120>
</BODY>
</HTML>
PHP
PHP is a server site scripting language.
PHP is implemented by Rasmus Lerdorf,
by using C, Perl technology.
PHP stands for Personal Home Page and
also it contains an alias name i.e.
Hypertext Pre Processor.
Features of PHP
PHP is cross-platform.
PHP is cross-server.
PHP is cross DB.
PHP 5.0 is providing a MYSQLlibrary to
communicate with MySQL DB.
PHP is open source.
PHP 5.0 supports more object oriented
programming concept.
Versions of PHP
Versions of PHP
PHP 4.0 -> 2000
It is cross-server
Zend engine 1.0 is introduced
Snarty template system
Basics
PHP loosely typed language
No need to provide the data types at the time of
variable declaration.
Every variable name should start with $ symbol.
Php is case sensitive in variable and in sensitive in
method/function.
Every php file extension should be .php
Php code should include within the script declaration
style tag.
Php is an interpreted language.
Every line in php should end with semicolon.
Functions in php
Print
Echo
Var_dump- to print along with data type.
Printf-to display variable value with format
specifier.
Printr-to display all elements of an array
Isset()-Whether the input variable is set with any
value or not.
Unset()- to delete the value of a variable.
Sort
Functions in php
Sort($arr1);
Rsort
Arranges in descending order
Asort
Ascending order with original keys
Arsort
Descending order with original keys
Ksort
Ascending order based on keys
krsort
Descending order based on keys
Array
$arr1=Array(1,XXXX,22);
Print_r($arr1);
<?php
$age=23;
$name=Arpita;
echo "Hi!", $name;
$x= print "Welcome";
print $x;
?>
To print
<?php
echo "This is a test version";
?>
Understanding OLEDB
ADO provides its functionality through
OLEDB an open standard designed to
allow access to all kinds of data.
Conceptually, OLE DB has three
components:
Data Providers
A data provider is any OLEDB provider that owns
data and exposes its data in a tabular form.
Examples of data providers include relational
DBMS, spreadsheets, file systems and email.
Contd..
Data consumers
Data consumers are applications that use the exposed by
data providers. In other words, any application that uses
ADO is an OLEDB consumer.
Service components
Although data providers can provide some database
functionality, OLE DB service components perform data
processing and transport functionality between data
consumers and data providers.
In this scenario neither the front-end application nor the
back end database is responsible for providing its own
database functionality. Instead, service components
provide functionality that any application can use when
accessing data.