You are on page 1of 44

INTRODUCTION:

Electronic commerce, commonly known as E-commerce, consists of the buying and selling of products or services over electronic systems such as the Internet and other computer networks. The amount of trade conducted electronically has grown dramatically since the spread of the Internet. A wide variety of commerce is conducted in this way, spurring and drawing on innovations in electronic funds transfer, supply chain management, Internet marketing, online transaction processing, electronic data interchange (EDI), automated inventory management systems, and automated data collection systems. Modern electronic commerce typically uses the World Wide Web at least at some point in the transaction's lifecycle, although it can encompass a wider range of technologies such as e-mail as well.

FEATURES
y ECommerce involves the sale or purchase of goods and services over computer networks by businesses, individuals, governments or other organisations. y ECommerce is the application of current and emerging information and communication technologies (ICTs) to conduct business. These include existing technologies like landline telephone and fax, but the ICTs offering most scope for small businesses are mobile phones, electronic mail and other Internet-based services. y ECommerce may involve selling directly from businesses-to-consumers (B2C eCommerce). For example, a number of craft producers and tourism enterprises have already found some success dealing directly with customers. y ECommerce can also be conducted directly between businesses (B2B eCommerce). This is by far the most common type of eCommerce at present. B2B activity includes portals that operate as electronic marketplaces or as auction sites. Benefits of eMarketplaces can include reduced costs, better research and quicker transactions for buyers.

There is also business-to-government activity (B2G eCommerce) that refers to the growth in supply of goods and services for online government procurement potentially a large growth area in developing countries.

Benefits of ECommerce:
Cost Reduction Benefits
y Reduced travel costs: by using a mobile phone, email and other ICTs to substitute for journeys. y Reduced cost of materials: more information means better choice of suppliers and more competitive prices. y Reduced marketing and distribution costs: for example, publishing a brochure online can reach an unlimited number of potential export customers and allow regular update. y Reduced sales costs: the Internet provides unprecedented opportunities for businesses to reduce the costs of trade locally and, even more, across borders. y More efficient supply chain management: can eliminate the need for middlemen leading to lower transaction costs (including marketing, sales, transaction processing), reduced overhead, and reduced inventory and labour costs. y Improved internal functions: cutting down on meetings, improving the exchange of critical knowledge, eliminating red tape, and streamlining communications.

Market Benefits
y Greater reach: a web presence can allow you to reach out to customers far beyond your immediate location. y More brand awareness: offering new avenues of promotion for products and services. y Improved customer service: providing more responsive order taking and aftersales service to customers; this, in turn, can lead to increased customer loyalty.

y Increased market awareness: you can become more aware of competition within your market and more aware of market changes, which can lead to product/service innovation or quality improvement.

Other Competitiveness Benefits


y Increased efficiency: eCommerce not only reduces costs but it can also increase the speed of transactions; both buying and selling. y Continuous trading: suppliers and customers, if they wish, can access a 24hour/7-day sales service particularly important when trading through time zones. y Specialisation: eCommerce can help you to focus your activities making it easier to build relationships with other enterprises and communicate your needs to support agencies.

Pitfalls of e-commerce:
There are great potential benefits but there are also pitfalls of going into eCommerce. . These are detailed below:

ECommerce will bring extra costs as well as potential cost savings. The start-up costs (initial investment in a computer/network connection, etc) will be high and there will be additional running costs .

ECommerce activity will need to run in parallel with existing business methods. For example, you will need to continue to produce paper-based marketing material (brochures, stationery, leaflets, etc) as well as building up your web presence. This will duplicate some activities adding to overall costs.

ECommerce may divert attention away from more important offline activities. It is important that online and offline efforts are not in competition with each other within a business. In fact, for most MSEs, offline activities (such as face-to-face 3

meetings and personal networking) will remain far more important than online communication.

An eCommerce venture may well fail completely like any new business venture. This highlights the importance for small businesses of not throwing all their eggs into the eCommerce basket.

However, there are also risks of ignoring eCommerce: Technology and innovation can bring positive changes to your business which can improve the way you do business in the future. The risks of not effectively embracing technology may be felt throughout your business in years to come. For example:

Having no website, or a badly designed or marketed website, may put your business at a disadvantage as compared with your competitors, particularly if you are an exporter or a tourism business.

Unsuitable or inadequate technology can mean that your enterprise is without the communications systems that it needs to compete efficiently.

Increasingly, enterprises that lack a customer and sales database may find it difficult to carry out the regular and effective direct marketing and communication that competitors conduct, and which customers expect.

Tools of Ecommerce:
The basic requirements to get started are as follows:

y y y

A computer. A landline telephone. A modem. This device converts digital information from computers into

electronic signals that can be transmitted over telephone lines. y Internet browser software. This usually comes installed already but make sure when purchasing your computer you ask if it has this software. y The services of an Internet Service Provider (ISP). These provide you with access to the Internet. y An email address in order that local, regional, and especially, international customers can communicate with you.

HYPER TEXT MARKUP LANGUAGE

(HTML)

INTRODUCTION TO HTML:
HTML stands for Hyper Text Markup Language. Hyper is the opposite of linear. It used to be that computer programs had to move in a linear fashion. This before this, this before this, and so on. HTML does not hold to that pattern and allows the person viewing the World Wide Web page to go anywhere, any time they want. Text is what you will use. Mark up is what you will do. You will write in plain English and then the browser marks up what you have written Language, because it's a language, really but the language is plain English.

Features of HTML
y y y y y y y y y y y HTML is simple and Logical An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor HTML tags are surrounded by the two characters < and > The surrounding characters are called angle brackets HTML tags normally come in pairs like <b> and </b> The first tag in a pair is the start tag, the second tag is the end tag The text between the start and end tags is the element content HTML tags are not case sensitive, <b> means the same as <B>

BASIC HTML TAGS


The first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document. The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window. The text between the <title> tags is the title of your document. The title is displayed in your browser's caption. The text between the <body> tags is the text that will be displayed in your browser.

Paragraphs Paragraphs are defined with the <p> tag. <p>This is a paragraph</p> <p>This is another paragraph</p>

HTML automatically adds an extra blank line before and after a paragraph.

Line Breaks The <br> tag is used when you want to end a line, but don't want to start a new paragraph. The <br> tag forces a line break wherever you place it. <p>This <br> is a para<br>graph with line breaks</p> The <br> tag is an empty tag. It has no closing tag.

Horizontal Rule The <HR> tag is used when we want to create a Horizontal Line. Again this is an empty tag.

CREATING LINKS IN HTML An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc. HTML uses the <a> (anchor) tag to create a link to another document. The <a> tag is used to create an anchor to link from, the href attribute is used to address the 8

document to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink.

The syntax of creating an anchor: <a href="url">Text to be displayed</a> <a href="http://www.nmbms.org/contacts.html">Contact us !</a>

FRAMES With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others. It also helps to create a navigational Bar

The Main tags involved in Frames are <frameset> Defines a set of frames <frame> Defines a sub window (a frame) <noframes> Defines a noframe section for browsers that do not handle frames [Iframe not included in this year]

The Frameset Tag The <frameset> tag defines how to divide the window into frames Each frameset defines a set of rows or columns The values of the rows/columns indicate the amount of screen area each row/column will occupy

The Frame Tag The <frame> tag defines what HTML document to put into each frame In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The HTML document "frame_a.htm" is put into the first column, and the HTML document "frame_b.htm" is put into the second column: <frameset cols="25%,75%"> 9

<frame name=a src="frame_a.htm"> <frame name=b src="frame_b.htm"> </frameset>

TABLES: Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). The letters td stands for "table data," which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc.

The Main tags involved in Tables are :

<table border="1" cellspacing=5 cellpadding=5 align=Center width=100%> <tr> <td> </table> Table Row Table Data Close the table To define a Row Create a column <th> Table Heading

[Table groups not included this year]

To display a table with borders, you will have to use the border attribute: Rows and Columns can be merged or spanned using :

<td rowspan=3> <td colspan=3> <td rowspan=2 colspan=3>

Span 3 roms Span 3 columns Span 2 roms + 3 columns

LISTS Unordered List | Ordered List | Definition List

10

Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically small black circles). An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. <ul> <li>Coffee</li> <li>Milk</li> </ul> There are 3 types of Unordered List <ul type =square/circle/disc> The value attribute in the <li> is not supported in UL

Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers. There are 5 types of ordered Lists. An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. <ol> <li>Coffee</li> <li>Milk</li> </ol> <<OL type=A / a / I / I / 1.> <LI value=4>

FORMS:
A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form.

The Tags involved in a Form are:

<form>

Defines a form for user input 11

<input> <textarea> <label> <fieldset> <legend> <select> <optgroup> <option> <button>

Defines an input field Defines a text-area (a multi-line text input control) Defines a label to a control Defines a fieldset Defines a caption for a fieldset Defines a selectable list (a drop-down box) Defines an option group Defines an option in the drop-down box Defines a push button

Input The most used form tag is the <input> tag. The type of input is specified with the type attribute. The most commonly used input types are explained below.

Text Fields: Text fields are used when you want the user to type letters, numbers, etc. in a form.

First name: <input type="text" name="firstname"><br> Last name: <input type="text" name="lastname">

The Text Area Box: This is a larger box, like the one above, that allows your reader to write something. The difference between the Text Box (above) and the Text Area is that the Text Box only allows for one line. The Text Area, however, is much larger and will allow for as many words as you want.

<TEXTAREA NAME="comment" ROWS=6 COLS=40> </TEXTAREA>

Please note that the TEXTAREA requires a </TEXTAREA> command, whereas the TEXT BOX command above did not. 12

Radio Buttons: Radio Buttons are used when you want the user to select one of a limited number of choices. <input type="radio" name="member" value="National"> National <input type="radio" name=" member " value="International "> International

Checkboxes: Checkboxes are used when you want the user to select one or more options of a limited number of choices.

Languages known <input type="checkbox" name="English">English <input type="checkbox" name="French">French

USING IMAGES IN HTML: The Image Tag and the Src Attribute In HTML, images are defined with the <img> tag. The <img> tag is empty, which means that it contains attributes only and it has no closing tag. To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display on your page.

The syntax of defining an image: <img src="url"> The browser puts the image where the image tag occurs in the document. If you put an image tag between two paragraphs, the browser shows the first paragraph, then the image, and then the second paragraph.

13

Backgrounds The <body> tag has two attributes where you can specify backgrounds. The background can be a color or an image.

Bgcolor The bgcolor attribute sets the background to a color. The value of this attribute can be a hexadecimal number, an RGB value, or a color name. <body bgcolor="#000000"> <body bgcolor="rgb(0,0,0)"> <body bgcolor="black"> The lines above all set the background color to black.

Background The background attribute sets the background to an image. The value of this attribute is the URL of the image you want to use. If the image is smaller than the browser window, the image will repeat itself until it fills the entire browser window.

<body background="clouds.gif"> <body background="http://www.nmbms.org/clouds.gif"> The URL can be relative (as in the first line above) or absolute (as in the second line above).

14

Example of Tables:
<HTML><HEAD><TITLE>MBA</TITLE> <BODY bgColor=pink> <TABLE cellPadding=16 align=center border=8> <TBODY> <TR> <TH colSpan=2><FONT size=8><FONT face="MONOTYPE CORSIVA" color=red>CARS </FONT></FONT> <TH><FONT size=8><FONT face="MONOTYPE CORSIVA" color=red>PRICES </FONT></FONT> <TR> <TD rowSpan=4><FONT size=6><B><FONT face="MONOTYPE CORSIVA" color=red>MARUTI</B></FONT></FONT> <TD><B><FONT color=red>800</B></FONT> <TD><B><FONT color=red>200000</B> </FONT> <TR> <TD><B><FONT color=red>ZEN</B></FONT> <TD><B><FONT color=red>300000</B> </FONT> <TR> <TD><B><FONT color=red>ALTO</B></FONT> <TD><B><FONT color=red>250000</B> </FONT> <TR> <TD><B><FONT color=red>SWIFT</B></FONT> <TD><B><FONT color=red>400000</B> </FONT> <TR> <TD><B><FONT color=red>PALIO</B></FONT> <TD><B><FONT color=red>400000</B> </FONT> <TR> <TD><B><FONT color=red>INDIGO</B></FONT> <TD><B><FONT color=red>400000</B> </FONT></TR></TBODY></TABLE></BODY></HTML>

Example of Forms:
<html> <body> <h1>My Form</h1> <form> <form action=""> <br> Input ur name: <br> 15

First name: <input type="text" name="firstname"/> <br> Last name: <input type="text" name="lastname"/> <br> <br> <br> Enter username & password: <br> Username: <input type="text" name="user"/> <br> Password: <input type="password" name="password"/> <br> <br> <br> Education: <br> <input type="radio" name="Education" value="Graduate"/>Graduate <br> <input type="radio" name="Education" value="PostGraduate"/>PostGraduate <br> <br> <br> <br> GENDER: <br> <input type="radio" name="gender" value="Male"/>Male <br> <input type="radio" name="gender" value="Female"/>Female <br> <br> <br> You own: <br> I have a : <input type="checkbox" name="vehicle" value="bike"/>bike <br> I have a : <input type="checkbox" name="vehicle" value="car"/>car <br> I have a : <input type="checkbox" name="vehicle" value="airplane"/>airplane </form> 16

<p> Note that when you type characters in a password feild, the browser displays asterisks or bullets instead of the characters. </p> </body> </html>

17

Example of Ordered list:


<html> <head> <title>MBA </title> </head> <body> <body bgcolor="sky blue"><font color="black"face = "monotype corsiva"><font size="30"> <b>Punjabi University Offers Following Courses<hr></b><br></font> <font color="red"><font size="20"><tab>Morning classes <br></font> <Ol type = "sqaure"> <FONT color="yellow"><font size="5"> <li>MBA <li>MCA</font> </Ol></li> <hr></b><br></font> <font color="red"><font size="20"><tab>Evening classes <br></font> <Ol type = "sqaure"> <FONT color="yellow"><font size="5"> <li>MBA <li>MCA</font> </Ol></li>

Example of Unordered list:


<html> <head> <title>MBA </title> </head> <body><body bgcolor="sky blue"><font color="black"face = "monotype corsiva"><font size="30"> <b>Punjabi University Offers Following Courses<hr></b><br></font> <font color="red"><font size="20"><tab>Morning classes <br></font> <ul type = "sqaure"> <FONT color="yellow"><font size="9"><li><h3>MBA <li>MCA</font> </ul></li><font color="red"><font size="20"> Evening classes<ul type = "disc"> <FONT color="yellow"><font size="9"><li><h3>MBA <li>MCA</font> </body> </html> 18

Example of using pictures:


<HTML> <TITLE>MBA</TITLE> <BODY BGCOLOR="lightgreen"> <hr color="red"> <B><FONT SIZE="15" COLOR="RED"> PICTURES </FONT> <hr color="red"> <BR> <br> <br> <IMG SRC="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.JPG"hight="50%"width="50%">&nbsp&nbsp <IMG SRC="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\sunset.JPG"hight="30%"width="30%">&nbsp&nbsp <BR> <br> <br> <hr color="red"> </BODY> </HTML>

Example of frames:
<html><TITLE>MBA</TITLE> <frameset cols="25,25,25,25"> <frame name="leftframe" src="PICT.html"> <frame name="upperframe" src="UNORDER.HTML" scrolling="auto"> <frameset rows="50%,50%"> <frame name="lowerframe" src="table.html" scrolling="auto"> <frame name="rightframe" src="ORDER LIST.html" scrolling="auto"> </frameset> <frame name="rightframe" src="form.html" scrolling="auto"> </frameset> </html>

19

LIMITATIONS OF HTML:
y

HTML defines a fixed set of elements i.e. you can only use the tags defined in HTML but cannot create their own tags. HTML is no easier to maintain .In case of Quotes. Termination of many elements and uncontained elements are allowed so margin for errors in HTML is much broader HTML is not suitable for data interchange Using HTML you can create animations Output can vary across different browsers HTML predefined element set does not work well with no conventional platforms, such as handled devices.

y y y y

20

JAVA SCRIPT

21

Introduction
JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari.
y y y y y y

JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means that scripts execute without preliminary compilation) Everyone can use JavaScript without purchasing a license

Features of JavaScript
y

y y

JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer

22

JavaScript's official name is ECMAScript. ECMAScript is developed and maintained by the ECMA organization. ECMA-262 is the official JavaScript standard. The language was invented by Brendan Eich at Netscape (with Navigator 2.0), and has appeared in all Netscape and Microsoft browsers since 1996. The development of ECMA-262 started in 1996, and the first edition of was adopted by the ECMA General Assembly in June 1997. The standard was approved as an international ISO (ISO/IEC 16262) standard in 1998.

Where to put JavaScript ? JavaScripts in a page will be executed immediately while the page loads into the browser. This is not always what we want. Sometimes we want to execute a script when a page loads, other times when a user triggers an event. Scripts in <head> Scripts to be executed when they are called, or when an event is triggered, go in the head section. If you place a script in the head section, you will ensure that the script is loaded before anyone uses it.

23

Example <html> <head> <script type="text/javascript"> function message() { alert("This alert box was called with the onload event"); } </script> </head> <body onload="message()"> </body> </html>

Scripts in <body> Scripts to be executed when the page loads go in the body section. If you place a script in the body section, it generates the content of a page. 24

Example <html> <head> </head> <body> <script type="text/javascript"> document.write("This message is written by JavaScript"); </script> </body></html> Scripts in <head> and <body> You can place an unlimited number of scripts in your document, so you can have scripts in both the body and the head section. <html> <head> <script type="text/javascript"> .... </script> </head> <body> <script type="text/javascript"> .... </script> </body> </html> JavaScript Statements JavaScript is a sequence of statements to be executed by the browser. JavaScript is Case Sensitive A JavaScript statement is a command to a browser. The purpose of the command is to tell the browser what to do.

The semicolon is entered at the end of the line and the browser is supposed to interpret the end of the line as the end of the statement. JavaScript Code JavaScript code (or just JavaScript) is a sequence of JavaScript statements Each statement is executed by the browser in the sequence they are written. 25

<script type="text/javascript"> document.write("<h1>This is a heading</h1>"); document.write("<p>This is a paragraph.</p>"); document.write("<p>This is another paragraph.</p>"); </script> JavaScript Block JavaScript statements can be grouped together in blocks. Blocks start with a left curly bracket {, and ends with a right curly bracket }. The purpose of a block is to make the sequence of statements execute together a block is used to group statements together in a function or in a condition (where a group of statements should be executed if a condition is met).

JavaScript Variables JavaScript variables are used to hold values or expressions. A variable can have a short name, like x, or a more descriptive name, like carname

Rules for JavaScript variable names: Variable names are case sensitive (y and Y are two different variables) Variable names must begin with a letter or the underscore character

<html> <body> <script type="text/javascript"> var firstname; firstname=Ajay"; document.write(firstname); document.write("<br />"); firstname=Kumar"; document.write(firstname); </script> <p>The script above declares a variable, assigns a value to it, displays the value, changes the value, and displays the value again.</p> </body> </html> The + Operator Used on Strings The + operator can also be used to add string variables or text values together.

26

txt1="What a very"; txt2="nice day"; txt3=txt1+txt2; After the execution of the statements above, the variable txt3 contains "What a very nice day". Declaring (Creating) JavaScript Variables Creating variables in JavaScript is most often referred to as "declaring" variables. You can declare JavaScript variables with the var statement:

var x; var carname; After the declaration, the variables are empty (they have no values yet). However, values can be assigned to the variables when you declare them:

var x=5; var carname="Volvo"; When you assign a text value to a variable, use quotes around the value. JavaScript Operators The assignment operator. The arithmetic operator

<html> <head> <script language="JavaScript"> var name =prompt("Enter your name","name"); </script> </head> <body> <script Language="JavaScript"> document.write("<h2> Hello "+name+"</h2>"); </script> </body> </html> The javascript prompt() method picks up a string from the user which is then assigned to the variable name The javascript code document.write() embedded in the <body> .. Tags writes the contents of the variable name to the client browser. Since the <HEAD> section is interpreted first so the name is picked up before anything is displayed on the client browser.

27

Programme showing Alert and Prompt dialogue box:

<html> <head> <script language="javascript"> alert("Don't open this site") var name = prompt("Enter your name") document.write("we have selected to you for taking information "+name); </script> </title> </head> <body> </body> </html>

28

JavaScript Arrays
Arrays are JavaScript objects that are capable of storing a sequence of values. These values are stored in indexed locations within the array. The length of an array is the number of elements that an array contains. The individual elements of an array are accessed by using the name of the array followed by the index value of the array element enclosed in square brackets. The array element index starts with 0. Hence the last array element index number is one less than the length of the array. An array must be declared before it is used.

<html> <head> <title> Viewing array elements</title></head> <body> <Script language="JavaScript"> friends=new Array(5); friends[0]="Anil"; friends[1]="Beena"; friends[2]="Camy"; friends[3]="Flora"; friends[4]="Harry"; document.write(friends[0]+"<BR>"); document.write(friends[1]+"<BR>"); document.write(friends[2]+"<BR>"); document.write(friends[3]+"<BR>"); document.write(friends[4]+"<BR>"); join_crit=friends.join(); document.write(join_crit); </script> </body> </html>

29

Join() returns all elements of the array joined together as a single string. Reverse() reverses the order of elements in the array. JavaScript arrays are implemented as objects. Objects are named collection of data that have properties and whose value may be accessed via methods. Property returns a value that identifies some aspect of the state of an object. Methods are used to read or modify the data contained in an objects property.

DIALOG BOXES JavaScript provides the ability to pickup users input or display small amounts of text to the user by using dialog boxes. These dialog boxes appear as separate windows and the contents depend upon the information provided by the user. This content is independent of the text in the HTML page containing the JavaScript and does not affect the content of the page in any way. 30

Types of Dialog boxes Alert Dialog Box Prompt Dialog Box Confirm Dialog Box Alert Dialog Box Alert dialog box can be used to direct small amount of textual output to a browsers window. The alert dialog box displays the string passed to the alert() method as well as an OK button. The JavaScript and the HTML program in which this code snippet is held will not continue processing until the OK button is clicked.

<HTML> <HEAD><TITLE>Example</TITLE></HEAD> <BODY> <SCRIPT language="JavaScript"> alert("Welcome to my home page"); document.write ('<IMG src="blue.jpg">'); </SCRIPT> </BODY> </HTML>

31

Prompt Dialog Box Displays the predefined message Displays a textbox and accepts user input Can pass what the user keyed into the textbox back to the javascript. Display the OK and CANCEL buttons Clicking the OK button causes the text typed inside the textbox to be passed to the program environment (i.e. JavaScript) Clicking on the CANCEL button causes a NULL value to the environment.

Syntax: Prompt (message, Default value); Example Prompt (Enter your favorite colour:, Blue); The value that the user keys into the textbox on the prompt dialog box is accepted and can be stored in a variable. Confirm Dailog Box This type of dialog box confirms the user action. 32

<html> <head><script type="text/javascript"> function show_confirm() { var r=confirm("Press a button"); if (r==true) { document.write("You pressed OK!"); } else { document.write("You pressed Cancel!"); } } </script></head> <body> <input type="button" onclick="show_confirm()" value="Show confirm box" /> </body></html>

33

JavaScript Functions A function is a piece of code that sits dormant until it is referenced or called upon to do its "function". In addition to controllable execution, functions are also a great time saver for doing repetitive tasks. Instead of having to type out the code every time you want something done, you can simply call the function multiple times to get the same effect. This benefit is also known as "code reusability". <html> <head> <script type="text/javascript"> function popup() { alert("Hello World") } </script> </head> <body> <input type="button" onclick="popup()" value="press"> </body> </html>

34

Cookie A cookie is a variable that is stored on the visitor's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With JavaScript, you can both create and retrieve cookie values

35

VBSCRIPT

36

Introduction to VBScript
VBScript is a scripting language A scripting language is a lightweight programming language VBScript is a light version of Microsoft's programming language Visual Basic

y y y

How does it Work:


When a VBScript is inserted into a HTML document, the Internet browser will read the HTML and interpret the VBScript. The VBScript can be executed immediately, or at a later event.

VBScript (short for Visual Basic Scripting Edition) is an Active Scripting language developed by Microsoft. The language's syntax reflects its pedigree as a limited variation of Microsoft's Visual Basic programming language. VBScript is installed as default in every desktop release of the Windows Operating System (OS) since Windows 98, and may or may not be included with Windows CE depending on the configuration and purpose of the device it is running on. It initially gained support from Windows administrators seeking an automation tool more powerful than the batch language first developed in the late 1970s. A VBScript script must be executed within a host environment, of which there are several provided on a standard install of Microsoft Windows (Windows Script Host, Windows Internet Explorer). When employed in Microsoft Internet Explorer, VBScript is similar in function to JavaScript, as a language to write functions that are embedded in or included from HTML pages and interact with the Document Object Model (DOM) of the page, to perform tasks not possible in HTML alone. Other web browsers such as Firefox, and Opera do not have built-in support for VBScript. This means that where client-side script

37

is required on a web site, developers almost always use JavaScript for cross-browser compatibility.

VBScript is the default scripting language in ASP. Client-side VBScript only works in Internet Explorer In VB semi-colon is unnecessary because a newline symbolizes the end of the statement.

<html> <body> <script type="text/vbscript"> Dim myVariable1, myVariable2 myVariable1 = 22 myVariable2 = "Howdy" document.write("My number is " & myVariable1) document.write("<br />My string is " & myVariable2) </script> </body> </html>

38

ACTIVE SERVER PAGES

39

Introduction to Active Server Pages:


Active Server Pages were introduced by Microsoft in 1996 as a downloadable feature of Internet Information Server 3.0. The concept is pretty simple: an Active Server Page allows code written in the JavaScript or VBScript languages to be embedded within the HTML tags of a Web page and executed on the Web server. There are great advantages to this, not the least of which is security. Since your code is executed on the Web server, only HTML tags are sent to the browser. The result is that the ASP code is invisible to the end user. Another upside to the server-side script concept is that it allows things like database connections to be made from the Web server rather than from the client. Therefore, any special configurations that might need to be set up, like ODBC data sources, only have to exist on the server. Of course, before you can create an Active Server Page (ASP), youll need to look at the software requirements. It is Microsoft's server-side script engine for dynamically-generated web pages. It is marketed as an addon to Internet Information Services (IIS). Programming ASP websites is made easier by various built-in objects. Each object corresponds to a group of frequently-used functionality useful for creating dynamic web pages. In ASP 2.0 there are six such builtin objects: Application, ASPError, Request, Response, Server, and Session. Session, for example, is a cookie-based session object that maintains variables from page to page. Most ASP pages are written in VBScript, but any other Active Scripting engine can be selected instead by using the @Language directive or the <script language="language" runat="server"> syntax. JScript (Microsoft's implementation of ECMAScript) is the other language that is usually available. PerlScript (a derivative of Perl) and others are available as third-party installable Active Scripting engines.

40

Differences Between VBScript and JavaScript


When calling a VBScript or a JavaScript procedure from an ASP file written in VBScript, you can use the "call" keyword followed by the procedure name. If a procedure requires parameters, the parameter list must be enclosed in parentheses when using the "call" keyword. If you omit the "call" keyword, the parameter list must not be enclosed in parentheses. If the procedure has no parameters, the parentheses are optional. When calling a JavaScript or a VBScript procedure from an ASP file written in JavaScript, always use parentheses after the procedure name.

What is IIS( Internet Information Server)?


IIS is a set of Internet-based services for servers created by Microsoft for use with Microsoft Windows. IIS comes with Windows 2000, XP, and Vista. It is also available for Windows NT. IIS is easy to install and ideal for developing and testing web applications.

What is PWS( Personal Web Server)?


PWS is for older Windows system like Windows 95, 98, and NT. PWS is easy to install and can be used for developing and testing web applications including ASP. It has become outdated and has security issues.

How to Install IIS on Windows XP and Windows 2000


Follow these steps to install IIS on Windows XP and Windows 2000: 1. 2. 3. 4. 5. 6. 7. On the Start menu, click Settings and select Control Panel Double-click Add or Remove Programs Click Add/Remove Windows Components Click Internet Information Services (IIS) Click Details Select the check box for World Wide Web Service, and click OK In Windows Component selection, click Next to install IIS

After you have installed IIS, make sure you install all patches for bugs and security problems. (Run Windows Update).

41

How to Install IIS on Windows Vista


Follow these steps to install IIS on Windows Vista: 1. 2. 3. 4. Open the Control Panel from the Start menu Double-click Programs and Features Click "Turn Windows features on or off" (a link to the left) Select the check box for Internet Information Services (IIS), and click OK

After you have installed IIS, make sure you install all patches for bugs and security problems. (Run Windows Update)

Programme

in

ASP

to

print

THIS

IS

MY

FIRST

ASPPROGRAMME
<html> <body> THIS IS MY FIRST ASP PROGRAMME </body> </html>

Output:THIS IS MY FIRST ASP PROGRAMME

42

To find Square Roots of first 20 natural numbers:


<html> <body> <b> Square Roots of first 20 natural numbers</b><br> <% dim i for i= 1 to 20 Response.Write(sqr(i) & "<br>") next %> </body> </html>

Output:Square Roots of first 20 natural numbers 1 1.4142135623731 1.73205080756888 2 2.23606797749979 2.44948974278318 2.64575131106459 2.82842712474619 3 3.16227766016838 3.3166247903554 3.46410161513775 3.60555127546399 3.74165738677394 3.87298334620742 4 4.12310562561766 4.24264068711928 4.35889894354067 4.47213595499958

43

Programme in ASP on assigning values to variables:


<% Dim name, age, subject %> <html> <body> <% Response.write("Before Assigning the value " & "Name=" & name) %> <BR> <% name="ABC" age="24" Subject="Finance" Response.write("After assigning the values" & "<br>") Response.write("Name=" & name & "<br>") Response.write("Age=" & age & "<br>") Response.write("Subject=" & subject) %> </body> </html>

Output:Before Assigning the value Name= After assigning the values Name=ABC Age=24 Subject=Finance

44

You might also like