IT- 604 – Web Technology UNIT I History of the internet, internetworking concepts, architecture, and protocol: switch, router, protocols for internetworking, internet address and domains. Introduction World Wide Web (WWW), working of web browser and web server, Web server and its deployment, N-tier architecture, services of web server, Common gateway interface (CGI), Uniform Resource Locator (URL), format of the URL, Hyper Text Transfer Protocol (HTTP), feature of HTTP protocol HTTP request-response model, Hyper Text Transfer Protocol Secure (HTTPS). UNIT III Introduction to Java Script, Basic concepts, variables and data types, functions, conditional statements, Loops, Operators, Arrays, Standard Objects and form processing in Java SNO CONTENT History of the internet, internetworking concepts, architecture, and 1 protocol: switch, router, PAGENO 1-7 2 protocols for internetworking, internet address and domains. Introduction World Wide Web 7-8 3 (WWW), working of web browser and web server, Web server and its deployment, N-tier 8-12 4 architecture, services of web server, Common gateway interface (CGI), Uniform Resource 12-14 5 Locator (URL), format of the URL, Hyper Text Transfer Protocol (HTTP), feature of HTTP 14-16 6 Introduction to Java Script, Basic concepts, variables and data types, functions, conditional 17-22 7 statements, Loops, Operators, Arrays, Standard Objects and form processing in Java 22-30 PAGE-1 UNIT-1 1.History of the Web:The idea of platform independent computer independent communication system gave birth to the modern web . It will never be advantageous to have point to point communication as it will be expensive and will become complex in case of very large system. Everything has to begin somewhere, so lets start the Web Standards with a focused history lesson. Below we'll give you a brief overview of the creation of the Internet, the World Wide Web, and the web standards that this entire series focuses upon If any terms are unfamiliar to you, don’t worry: if they’re important for learning web development they’ll be defined in the later articles that go into more depth on each subject, and you can always search them out using your search engine of choice! If you are already familiar with the history of the Internet or the World Wide Web, feel free to skip to the section on .the browser market was dominated by Internet Explorer 4 and Netscape Navigator 4. A beta version of Internet Explorer 5 was then released, and it implemented a new and proprietary dynamic HTML, which meant that professional web developers needed to know five different ways of writing JavaScript.As a result, a group of professional web developers and designers banded together. This group called themselves the Web Standards Project . The idea was that by calling the W3C documents standards rather than recommendations, they might be able to convince Microsoft and Netscape to support them. The early method of spreading the call to action was to use a traditional advertising technique called a roadblock, where a company would take out an advert on all broadcast channels at the same time, so no matter how a viewer would flick between channels, they would get exactly the same message. The WaSP published an article simultaneously on various web development focused sites including builder.com, Wired online, and some popular mailing lists. Another technique the WaSP used was to ridicule the companies involved with the W3C (and other standards bodies) that focused more on creating new, often self-serving, features rather than working to get the basic existing standards supported correctly in their products to start with (this includes some browser companies that shall remain nameless here). This doesn't mean that the WaSP ridiculed . PAGE-2 The W3C has a few full time staff, but most of the people who work on the standards are volunteers from member companies, Microsoft, Opera, Mozilla, Apple, Google, IBM and Adobe, to name a few of the bigger ones. This event lead directly to the creation of the US Department of Defiance, ARPA, due to a recognized need for an organization that could research and develop advanced ideas and technology. Perhaps their most famous project .,Microsoft released Internet Explorer 5 Macintosh Edition. This was a very important milestone, it being the default browser installed with the Mac OS at the time, and having a reasonable level of support for the W3C recommendations too. Along with Opera's decent level of support for CSS and HTML, it contributed to a general positive movement, where web developers and designers finally felt comfortable designing sites using web standards, as they knew they would work to a reasonable level across multiple browsers. The WaSP persuaded Netscape to postpone the release of the 5.0 version of Netscape Navigator until it was much more compliant (this work formed the basis of what is now Firefox, a very popular browser). The WaSP also created a Dreamweaver Task Force to encourage Macromedia to change their popular web authoring tool to encourage and support the creation of compliant sites. 2.Internetworking Concept: internetworking is the practice of connecting Computer network with other networks through the use of gateways that provide a common method of routing information packets between the networks. The resulting system of interconnected networks is called an internetwork, or simply an internet. Internetworking is a combination of the words inter ("between") and networking; not internetworking or international-network. The most notable example of internetworking is the Internet a network of networks based on many underlying hardware technologies, but unified by an internetworking protocol standard, the Internet Protocol Suite often also referred to as TCP/IP. The smallest amount of effort to create an internet (an internetwork not the Internet), is to have two LANs of computers connected to each other via a router. Simply using either a switch or a hub to connect two local area networks together doesn't imply internetworking, it just expands the original LAN.or an internet Internetworking is a scheme for interconnecting multiple networks of dissimilar technologies. Page-3 Internetworking uses both hardware and software. Extra hardware is positioned between the connected networks. Extra software is installed on each attached computer. A system of interconnected networks is called an internetwork An internetwork is composed of arbitrarily many networks interconnected by routers.Routers can have more than two interfaces Concept of internetworking An internetwork is a collection of individual networks, connected by intermediate networking devices, that functions as a single large network. Internetworking refers to the industry, products, and procedures that meet the challenge of creating and administering internetworks. illustrates some different kinds of network technologies that can be interconnected by routers and other networking devices to create an internetwork. Today, high-speed LANs and switched internetworks are becoming widely used, largely because they operate at very high speeds and support such high-bandwidth applications as voice and video conferencing. Internetworking evolved as a solution to three key problems: isolated LANs, duplication of resources, and a lack of network management. Isolated LANS made electronic communication between different offices or departments impossible. Duplication of resources meant that the same hardware and software had to be supplied to each office or department, as did a separate support staff. This lack of network management meant that no centralized method of managing . page-4 Internetworking Challenges:Implementing a functional internetwork is no simple task. Many challenges must be faced, especially in the areas of connectivity, reliability, network management, and flexibility. Each area is key in establishing an efficient and effective internetwork. The challenge when connecting various systems is to support communication between disparate technologies. Different sites, for example, may use different types of media, or they might operate at varying speeds. Another essential consideration, reliable service, must be maintained in any internetwork. Individual users and entire organizations depend on consistent, reliable access to network resources. Furthermore, network management must provide centralized support and troubleshooting capabilities in an internetwork. Configuration, security, performance, and other issues must be adequately addressed for the internetwork to function smoothly. Flexibility, the final concern, is necessary for network expansion and new applications and services. Types of Internetworking:1.Connection Oriented Internetworking. 2 . Connectionless Internetworking. 1.Connection oriented InternetworkingIn the concatenated virtual circuit internetworks a logical connection to a host in a distant network is setup , since the destination is remote .connection-oriented (CO)networks have some fundamental distinguishing features. are those in which connection setup is performed prior to information transfer. In CL networks no explicit connection setup actions are executed prior to transmitting data; instead, data packets are routed to their destinations based on information in their headers. CL networks do not suffer the delay and processing. This gateway records the existence of the virtual circuit to a router in the next subnet. PAGE-5 2.Connectionless InternetworkingConnectionless (CL) networks and connection-oriented Networks have some fundamental distinguishing features. Networks are those in which connection setup is performed prior To information transfer. In CL networks no explicit connection setup actions are executed prior to transmitting data; instead, data packets are routed to their destinations based on information in their headers. CL networks do not suffer the delay and processing overhead associated with connection setup. In contrast, information about the connections in CO networks helps in providing service guarantees and, furthermore, makes it possible to most efficiently use network resources (e.g., bandwidth) by “switching” them to appropriate connections as they are set up Comparison of the three alternatives of IP switching, ATM/ MPLS switching and circuit-switching, is different if the CO network is operated in switched mode. This is because when the network is operated in switched mode, it is possible to perform. 3.Protocol,Router, SwitchProtocolIn the networking and communications area, a protocol is the formal specification that defines the procedures that must be followed when transmitting or receiving data. Protocols define the format, timing, sequence, and error checking used on the network. In plain english, the above means that if you have 2 or more devices e.g computers which want to communicate, then they need a common "Protocol" which is a set of rules that guide the computers on how and when to talk to each other. The way this "defenition" happens in computer land is by the RFC's (Requests For Comments) where the IETF (a group of enginners with no life) make up the new standards and protocols and then the major vendors (IBM, Cisco, Microsoft, Novell) follow these standards and implement them in their products to make more money and try to take over this world ! There are hundreads of protocols out there and it is impossible to list them all here, but instead we have included some of the most popular protocols around so you can read up on them and Page-6 learn more about them. The table below shows the most popular TCP/IP protocols. The OSI model is there for you to see which layer each of these protocols work at. One thing which you should keep in mind is that as you move from the lower layers (Physical) to the upper layers (Applications), more processing time is needed by the device that's dealing with the protocol 1. FTP 2. TCP 3. SMTP 4. UDP 5. DNS. 2.ROUTERWelcome to the Routers section. Here we will analyse routers quite some depth; what they do and how they work. We must point out that knowlege on the OSI model is recommended, plus understanding of how data is sent across the network medium. If you find the information a bit too confusing or don't quite understand it, we suggest you go back to the networking section and do some reading on the OSI model and Protocols. Routers are very common today in every network area, this is mainly because every network these days connect to some other network, whether it's the Internet or some other remote site. Routers get their name from what they do.... which is route data from one network to another. For example, if you had a company which had an office in Sydney and another one in Melbourne, then to connect the two you would use a leased line to which you would connect a router at each end. Any traffic which needs to travel from one site to another will be routed via the routers, while all the other unecessary traffic is filtered (blocked), thus saving you valuable bandwidth and money. Hardware routers:- are dedicated hardware that run special software created by their vendors to give them the routing capabilities, plus a whole lot more functions. Hardware routers a most common amongst companies as they are faster and more reliable. In the earlier days, hardware routers would start from a couple of hundred dollars, however their prices today are extremely low for cheaper-brand models Page-7 Software routers :- perform similar tasks as the above hardware routers (route data), but they don't come in small flashy boxes. A software router could be an Windows , Linux or Novell NetWare server. All network servers have built-in routing capabilities SWITCH:A switch is a simple device that has two states - on and off - just like a light switch. Switches come in a variety of different shapes and sizes and are operated in different ways. Usually this is through a push motion but you can also buy switches that you grasp, pull, suck or even blink into. The most common type of switch is the jelly bean switch (pictured). There is a selection of switches and some video examples of their operation on my switch hardware page People who find it difficult to access the keyboard and the mouse can use a single switch or a combination of switches instead. Switches can help people with a variety of different physical disabilities from mild conditions like RSI to complete paralysis. They are also suitable for people with severe learning difficulties as they are a simple, understandable method of accessing a computer. 4.Introduction of world wide web(www)The World Wide Web ("WWW" or simply the "Web") is a global information medium which users can read and write via computers connected to the Internet The term is often mistakenly used as a synonym for the Internet itself, but the Web is a service that operates over the Internet, just as e-mail also does. The history of the Internet dates back significantly further than that of the World Wide Web.. In 1984 Berners-Lee returned to CERN, and considered its problems of information management: physicists from around the world needed to share data, yet they lacked common machines and any shared presentation software. Shortly after Berners-Lee's return to CERN, TCP/IP protocols were installed on some key nonUnix machines at the institution, turning it into the largest Internet site in Europe within a few years. As a result, CERN's infrastructure was ready for Berners-Lee to create the Web. The World Wide Web is a system that makes exchange of data on the Internet easy and efficient. It consists of two basic components : 1. The Web Server : a computer and software ("server" can refer to either) that stores and distributes data to other computers throughout the Internet that request the information. Page-8 To use the Web, an individual needs a computer with Web browser software and a modem installed. After the Web browser is launched (started), the computer is directed to dial an Internet service provider (with which an account has been arranged). The browser is then given the address of a Web "site" where a Web server will respond by sending a "page" of information. This "page" may have text of various sizes and styles, with pictures and other graphics intermixed. Certain pictures and text will have special highlights or underlines. These special highlights indicate that further information is available. All the individual needs to do is to move the mouse indicator over the highlighted item and click, and the remote Web server will respond with the appropriate information. More than text and picture can be offered Movies and animation Moving graphics Sound files and real-time sound Database and catalogs Programs that run directly on your computer Opportunities to send information to the owner of the Web site Furthermore, Internet information technologies that wee being used around that time were plugged with limitations, such as the following Platform dependence Lack of standards Incapability of richly formatting content Limited virtually to plain text Cryptic user interface Lack of security Familiarity with UNIX often required Incapability of being extended to accommodate new technologies 5. working of web browserA browser is software that is used to access the internet. A browser lets you visit websites and do activities within them like login, view multimedia, link from one site to another, visit one page from another, print, send and receive email, among many other activities. The most common browser software titles on the market are: Microsoft Internet Explorer, Google's Chrome, Mozilla Firefox, Apple's Safari, and Opera. Browser availability depends on the operating system your computer is using (for example: Microsoft Windows, Linux, Ubuntu, Mac OS, among others) When you type a web page address such as www.allaboutcookies.org into your browser, that web page in its entirety is not actually stored on a server ready and waiting to be delivered. In fact each web page that you request is individually created in response to your request. Page-9 You are actually calling up a list of requests to get content from various resource directories or servers on which the content for that page is stored. It is rather like a recipe for a cake - you have a shopping list of ingredients (requests for content) that when combined in the correct order bakes a cake (the web page).The page maybe made up from content from different sources. Images may come from one server, text content from another, scripts such as date scripts from another and ads from another. As soon as you move to another page, the page that you have just viewed disappears. This is the dynamic nature of websites much of the Internet, the World Wide Web operates on a client/server model. You run a web client on your computer—called a web browser—such as Microsoft’s Internet Explorer or Firefox. That client contacts a web server and requests information or resources. The web server locates and then sends the information to the web browser, which displays the results. When web browsers contact servers, they’re asking to be sent pages built with Hypertext Markup Language (HTML). Browsers interpret those pages and display them on your computer. They also can dis-play applications, programs, animations, and similar material created with programming languages such as Java and ActiveX, scripting languages such as JavaScript, and techniques such as AJAX. Sometimes, home pages contain links to files the web browser can’t play or display, such as sound or animation files. In that case, you need a plug-in or a helper application. You configure your web browser or operating system to use the helper application or plug-in whenever it encounters a sound, animation, or other type of file the browser can’t run or play. Over the years, web browsers have become increasingly sophisticated. Browsers are now fullblown software suites that can do everything from videoconferencing to letting you create and publish HTML pages. Browsers now also blur the line between your local computer and the Internet—in essence, they can make your computer and the Internet function as a single computer system. Increasingly, a browser is not just a single piece of software, but an entire suite. The newest version of Internet Explorer, for example, includes security features such as an anti-phishing filter. The Firefox browser has a companion piece of email software called Thunderbird that can be downloaded as well. Page-10 6.Webserver and its DevelopmentWeb servers are computers that deliver (serves up) Web pages. Every Web server has an IP address and possibly a domain name. For example, if you enter the URLhttp://www.pcwebopedia.com/index.html in your browser, this sends a request to the Web server whose domain name is pcwebopedia.com. The server then fetches the page named index.html and sends it to your browser. Any computer can be turned into a Web server by installing server software and connecting the machine to the Internet. There are many Web server software applications, including public domain software from NCSA and Apache, and commercial packages from Microsoft Netscape and other A web server is an information technology that processes requests via HTTP the basic network protocol used to distribute information on the World Wide Web. The term can refer either to the entire computer system an appliance or specifically to the software that accepts and supervises the HTTP requests. The most common use of web servers is to host websites but there are other uses such as gaming data storage, running enterprise applications handling email FTP or other web uses The primary function of a web server is to store, process and deliver web pages to clients. The communication between client and server takes place using the Hypertext Transfer Protocol (HTTP). Pages delivered are most frequently HTML documents which may include images style sheets and scripts in addition to text content. A user agent commonly a web browser or web crawler initiates communication by making a request for a specific resource using HTTP and the server responds with the content of that resource or an error message if unable to do so. The resource is typically a real file on the server's secondary storage but this is not necessarily the case and depends on how the web server is implemented. After doing some search here, I found next to no questions on Have you developed a web server? (no matter what language) What are the gotchas and other good tips can you supply . Web development is a broad term for the work involved in developing a web site for the Internet (World Wide Web)or an intranet (a private network). Web development can range from developing the simplest static single page of plain text to the most complex web-based internet applications electronic businesses and social network services . A more comprehensive list tasks to which web development commonly refers, may include web design web content . Page-11 configuration, and e-commerce development. Among web professionals, "web development" usually refers to the main non-design aspects of building web sites: writing markup and coding. Most recently Web development has come to mean the creation of content management systems or CMS. These CMS can be made from scratch, proprietary (such as Open Text or open source (such as Drupal. In broad terms the CMS acts as middleware between the database and the user through the browser. A principle benefit of a CMS is that it allows non-technical people to make changes to their Web site without having technical knowledge. For larger organizations and businesses, web development teams can consist of hundreds of people (web developers) and follow standard methods like Agile methodologies while developing websites. Smaller organizations may only require a single permanent or contracting developer, or secondary assignment to related job positions such as a graphic designer and/or information systems technician. Web development may be a collaborative effort between departments rather than the domain of a designated department Since the commercialization of the web development has been a growing industry. 7.Common Gateway Interface(CGI)The Common Gateway Interface (CGI) is what allows a Web server to run APPLICATIONS that communicate with Web pages. Remember that Java and JavaScript APPLETS are run on the client. They are downloaded to the Web browser before execution. CGI is run on the server which makes it especially useful for applications that need access to files and facilities available on the server (like databases). CGI applications do not monitor events on the client. You cannot perform image swapping on the browser using On Mouse Over events. Refer to the following diagram ********* ++++++++++ * Web * ---> + Web + ---> +++++++++++++++ *Browser* + Server + CGI APPLICATION * * <--- + + <--- +++++++++++++++ ********* ++++++++++ The Web Browser makes a request to the Web server for the CGI application (<FORM ACTION="cgi-bin/guest.cgi" METHOD=POST>) The Web Server executes the corresponding CGI application and sends it the POSTed data from the Web page if any exists. The CGI application executes returning data back to the Web Server. The Web Server passes this data back to the Web Browse <FORM ACTION="cgi-bin/guest.cgi" METHOD=POST> <INPUT TYPE=TEXT NAME=lookfor SIZE=20 VALUE="John"> <INPUT TYPE=SUBMIT VALUE="Search Database"> </FORM> PAGE-12 CGI is a means by which Web servers interface to other application programs, thus extending the services provided by the Web server. By way of CGI scripts, users gain program access to Web servers and can extend the capability of HTML. It should be noted that the term ‘Web server’ does not necessarily mean a physical piece of harware; it is a piece of software that can reside locally or on another remote machine. CGI was one of the first practical techniques for creating dynamic content and it has made possible all sorts of new functionality in Web pages. CGI has become a de facto standard used on most modern Web servers today 8.Uniform Resource LocatorThe point-and-click idiom of World Wide Web usage has made Internet browsing as easy as tapping on the door with your index finger, but every Net surfer soon learns that, too often, the summons remains unanswered. The now-familiar Uniform Resource Locator (URL) can change at the whim of hardware reconfiguration or file system reorganization or with changes in organizational structure, leaving users stranded. +------- + | | | | | C | | L | | I | | E | | N | | T | | | | | +--------+ PURL +----------+ Resolver associates ------------>> | | PURL with unique URL; | PURL | maintenance utilities URL | SERVER | facilitate creation of <<------------ | | PURLs and modification +----------+ of associated URLs. URL +----------+ ------------>> | | | RESOURCE | Resource | SERVER | <<------------ | | +----------+ The redirection used in the OCLC PURL Service is a standard HTTP feature. Redirection keeps the OCLC PURL Server load light. For example, the single processor Sun4 file server currently running the OCLC PURL Service can support over 50 resolutions per second on a 500,000 PURL database. In addition to performing redirection, the PURL Server could serve all/some documents directly. The key to the PURL Server is indirection, not redirection--i.e., naming items to separate location from identification. Berners-Lee later regretted the use of dots to separate the parts of the domain name within URIs wishing he had used slashes throughout. For example, http://www.example.com/path/to/name would have been written http:com/example/www/path/to/name. Berners-Lee has also said that, given the colon following the URI scheme the two slashes before the domain name were also unnecessary Page-13 A hostname is a domain name assigned to a host computer. This is usually a combination of the host's local name with its parent domain's name. For example, en.example.org consists of a local hostname (en) and the domain name example.org. The hostname is translated into an IP address via the local hosts file or the domain name system (DNS) resolver. It is possible for a single host computer to have several hostnames; but generally the operating system of the host prefers to have one hostname that the host uses for itself. Any domain name can also be a hostname, as long as the restrictions mentioned below are followed. For example, both "en.example.org" and "example.org" can be hostnames if they both have IP addresses assigned to them. The domain name "xyz.example.org" may not be a hostname if it does not have an IP address, but "aa.xyz.example.org" may still be a hostname. All hostnames are domain names, but not all domain names are hostnames 9.Hyper text transfer protocol- The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web. Hypertext is structured text that uses logical links (hyperlinks) between nodes containing text. HTTP is the protocol to exchange or transfer hypertext. HTTP is designed to permit intermediate network elements to improve or enable communications between clients and servers. High-traffic websites often benefit from web cache servers that deliver content on behalf of upstream servers to improve response time. Web browsers cache previously accessed web resources and reuse them when possible to reduce network traffic. HTTP proxy servers at private network boundaries can facilitate communication for clients without a globally routable address, by relaying messages with external servers HTTP (Hypertext Transfer Protocol) is perhaps the most popular application protocol used in the Internet (or The WEB). HTTP is an asymmetric request-response client-server protocol as illustrated. An HTTP client sends a request message to an HTTP server. The server, in turn, returns a response message. In other words, HTTP is a pull protocol, the client pulls information from the server (instead of server pushes information down to the client) HTTP is a stateless protocol. In other words, the current request does not know what has been done in the previous requests. HTTP permits negotiating of data type and representation, so as to allow systems to be built independently of the data being transferred. Quoting from the RFC2616: "The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. PAGE-14 It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. Short for Hypertexts Transfer Protocol, HTTP is a set of standards that allow users of the World Wide Web to exchange information found on web pages. When accessing any web page entering http:// in front of the address tells the browser to communicate over HTTP. For example, the URL for Computer Hope is http://www.computerhope.com. Today's browsers no longer require HTTP in front of the URL since it is the default method of communication. However, it is kept in browsers because of the need to separate protocols such as FTP. Below are a few of the major facts on HTTP. HTTPSHypertext Transfer Protocol over Secure, HTTPS is a secure method of accessing or sending information across a web page. All data sent over HTTPS is encrypted before it is sent, this prevents anyone from understanding that information if intercepted. Because data is encrypted over HTTPS, it is slower than HTTP, which is why HTTPS is only used when requiring login information or with pages that contain sensitive information such as an online bank web page. HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of the protocol. The protocol versioning policy is intended to allow the sender to indicate the format of a message and its capacity for understanding further HTTP communication, rather than the features obtained via that communication. No change is made to the version number for the addition of message components which do not affect communication behavior or which only add to extensible field values. The <minor> number is incremented when the changes made to the protocol add features which do not change the general message parsing algorithm, but which may add to the message semantics and imply additional capabilities of the sender. The <major> number is incremented when the format of a message within the protocol is changed. See RFC for a fuller explanation HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT ADVANTAGE anyone can edit easy to use and learn Wikis are instantaneous so there is no need to wait for a publisher to create a new edition or update information people located in different parts of the world can work on the same document the wiki software keeps track of every edit made and it's a simple process to revert back to a previous version of an article Page-15 widens access to the power of web publishing to non-technical users the wiki has no predetermined structure - consequently it is a flexible tool which can be used for a wide range of applications there are a wide range of open source software wiki's to choose from so licensing costs shouldn't be a barrier to installing an institutions. Disadvantages Advantages in one context, may be disadvantages in another. Anyone can edit so this may be too open for some applications, for example confidential documentation. However it is possible to regulate user access. Open to SPAM and Vandalism if not managed properly. There are easy ways to restore a page however, and on Wiki Educator you must be logged in to edit pages so this reduces vandalism by automated spam bots. Requires Internet connectivity to collaborate, but technologies to produce print versions of articles are improving The flexibility of a wiki's structure can mean that information becomes disorganised. As a wiki grows, the community plans and administers the structure collaboratively. The usual guidelines for healthy computer use 10.DomainDomain names are used to identify one or more For example, the domain name microsoft.com represents about a dozen IP addresses. Domain names are used in URLs to identify particular Web pages For example, in the URL . 10.Internet address An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or network interface Page-16 identification and location addressing. Its role has been characterized as follows: "A name indicates what we seek. An address indicates where it is. A route indicates how to get there." The designers of the Internet Protocol defined an IP address as a 32-bit number and this system, known as Internet Protocol Version 4 (IPv4), is still in use today. However, due to the enormous growth of the Internet and the predicted depletion of available addresses a new version of IP (IPv6) using 128 bits for the address, was developed in 1995.IPv6 was standardized as RFC 2460 in 1998. New computer users often confuse domain names with universal resource locators, or URLs, and Internet Protocol, or IP, addresses. This confusion is understandable. It is worth learning the differences between them because these terms are ubiquitous. It is also helpful to be able to use terms correctly when communicating to technicians or other people within a professional organization. The common fictitious domain name, www.example.com, is comprised of three essential parts: .com - This is the top-level domain. .example. - This is a sub-domain. UNIT-3 PAGE-17 1. Introduction to java scriptJavaScript is a dynamic computer programming language. It is most commonly used as part of web browsers whose implementations allow client-side scripts to interact with the user control the browser, communicate asynchronously and alter the document content that is displayed.It is also used in server-side network programming with runtime environments such as Node. is game development and the creation of desktop and mobile applications. With the rise of the single-page web app and JavaScript-heavy sites, it is increasingly being used as a compile target for source-to-source compilers from both dynamic languages and static languages . In particular, Emscripten and highly optimized JIT compilers in tandem with asm. js which is friendly to AOT compilers like Odin Monkey have enabled C and C++ programs to be compiled into JavaScript and execute at near-native speeds, making JavaScript be considered the "assembly language of the web" according to its creator and others. JavaScript is classified as a prototype-based scripting language with dynamic typing and firstclass functions . This mix of features makes it a multi-paradigm language, supporting objectoriented imperative and functional programming styles. Despite some naming, syntactic and standard library similarities, JavaScript and Java are otherwise unrelated and have very different semantics. The syntax of JavaScript is actually derived from C while the semantics and design are influenced by the Self and Scheme programming languages. JavaScript is also used in environments that aren't web-based, such as PDF documents, sitespecific browsers and desktop widgets Newer and faster JavaScript virtual machine (VMs) and platforms built upon them have also increased the popularity of JavaScript for server-side web applications. On the client side, JavaScript has been traditionally implemented as an interpreted language, but more recent browsers perform just-in-time compilation. function factorial(n) { if (n === 0) { return 1; } return n * factorial(n - 1); } Page-18 The syntax of JavaScript is the set of rules that define a correctly structured JavaScript program. The examples below make use of the alert function for standard text output. The JavaScript standard library lacks an official standard text output function. However, given that JavaScript is mainly used for client-side scripting within modern web browsers and that almost all web browsers provide the alert function, alert is used in the example JavaScript has no relation to Java aside from having a C-like syntax. Netscape developed JavaScript, and Sun Microsystems developed Java. The rest of this section assumes a background in programming, you may skip to the next section, if you like. Variables have a static type (integer or string for example) which remains the same during the lifespan of a running program in Java, and have a dynamic type (Number or String for example) which can change during the lifespan of a running program in JavaScript. Variables must be declared prior to use in Java, and have a undefined value when referred to prior to assignment in JavaScript. Java has an extensive collection of libraries which can be imported for use in programs. JavaScript does not provide any means to import libraries or external JavaScript code. JavaScript engines must extend the JavaScript language beyond the ECMAScript language standard, if additional functionality is desired, such as the required functionality provided by V8, or the Document Object Model found in many web browsers.Java includes classes and object instances, and JavaScript uses prototypes. 2.Basic conceptJavaScript is a rich and expressive language in its own right. This section covers the basic concepts of JavaScript, as well as some frequent pitfalls for people who have not used JavaScript before. While it will be of particular value to people with no programming experience, even people who have used other programming languages may benefit from learning about some of the peculiarities of JavaScript. A simple variable declaration Page-3 var foo = 'hello world'; PAGE-19 A switch statement: switch (foo) { case 'bar': alert('the value was bar -- yay!'); break; case 'baz': alert('boo baz :('); break; default: alert('everything else is just ok'); break; } The following is some reasons why javascript is used: Can dynamically generate HTML elements in runtime Can read and change contents of HTML elements Can Handle Events Is used for Client side validation Can detect visitor browser and settings Can create cookies Can directly access files on the web server Can directly access files on the user's system javaScript is a scripting language which aim to make web pages more interactive and dynamic . It allows to create applications that run over the web and it's free “no need to buy a license, so it's open standards”, also it can act as Object-Oriented Language. jQuery is built on top of JavaScript, a rich and expressive language in its own right. This section covers the basic concepts of JavaScript, as well as some frequent pitfalls for people who have not used JavaScript before. While it will be of particular value to people with no programming experience, even people who have used other programming languages may benefit from learning about some of the peculiarities of JavaScript. PAGE-20 // create a function that will greet a person, // and assign the function to the `greet` variable var greet = function( person, message ) { var greeting = 'Hello, ' + person + '!'; log( greeting + ' ' + message ); }; // use the function to greet Jory, passing in her // name and the message we want to use greet( 'Jory', 'Welcome to JavaScript' ); // use the function to greet Rebecca, passing in her // name and a different message greet( 'Rebecca', 'Thanks for joining us' ); 3.Variables and data typesJavaScript variables are containers for storing data values. In this example, x, y, and z, are variables Example var x = 5; var y = 6; var z = x + y; PAGE-21 The general rules for constructing names for variables (unique identifiers) are: Names can contain letters, digits, underscores, and dollar signs. Names must begin with a letter Names can also begin with $ and _ (but we will not use it in this tutorial) Names are case sensitive (y and Y are different variables) Reserved words (like JavaScript keywords) cannot be used as name JavaScript Data Types JavaScript variables can hold numbers like 100, and text values like "John Doe". In programming, text values are called text strings. JavaScript can handle many types of data, but for now, just think of numbers and strings. Strings are written inside double or single quotes. Numbers are written without quotes. If you put quotes around a number, it will be treated as a text string. Example var pi = 3.14; var person = "John Doe"; var answer = 'Yes I am!'; Declaring (Creating) JavaScript Variables Creating a variable in JavaScript is called "declaring" a variable. You declare a JavaScript variable with the var keyword. var carName; After the declaration, the variable is empty (it has no value). To assign a value to the variable, use the equal sign: carName = "Volvo"; You can also assign a value to the variable when you declare it: PAGE-22 var carName = "Volvo"; In the example below, we create a variable called carName and assign the value "Volvo" to it. Then we "output" the value inside an HTML paragraph with id="demo": Example <p id="demo"></p> <script> var carName = "Volvo"; document.getElementById("demo").innerHTML = carName; </script> 4.function ,statement ,LoopsFuction:JavaScript functions are defined with the function keyword. You can use a function declaration or a function expression A function is a group of reusable code which can be called anywhere in your programme. This eliminates the need of writing same code again and again. This will help programmers to write modular code. You can divide your big programme in a number of small and manageable functions. Like any other advance programming language, JavaScript also supports all the features necessary to write modular code using functions. You must have seen functions like alert() and write() in previous chapters. We are using these function again and again but they have been written in core JavaScript only once. JavaScript allows us to write our own functions as well. This section will explain you how to write your own functions in JavaScript. PAGE-23 Function Declarations function functionName(parameters) { code to be executed } Example function myFunction(a, b) { return a * b; } Before we use a function we need to define that function. The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces. The basic syntax is shown here: <script type="text/javascript"> <!-function functionname(parameter-list) { statements } //--> </script Statements :In HTML, JavaScript statements are "instructions" to be "executed" by the web browser. These statements are common to all programming languages, so if you understand them for JavaScript, you understand them for all other languages and never have to learn the concepts again, only the specific syntax of the programming language. PAGE-24 EXAMPLE:var x = 5; var y = 6; var z = x + y; document.getElementById("demo").innerHTML = z; very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In JavaScript we have the following conditional statements: Use if to specify a block of code to be executed, if a specified condition is true Use else to specify a block of code to be executed, if the same condition is false Use else if to specify a new condition to test, if the first condition is false Use switch to specify many alternative blocks of code to be executed Syntax if (hour < 18) { greeting = "Good day"; } Loops:Loops are handy, if you want to run the same code over and over again, each time with a different value. The for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement or a set of statements executed in the loop. An expression (including assignment expressions) or variable declaration. Typically used to initialize a counter variable. This expression may optionally declare new variables with the var keyword. These variables are not local to the loop, i.e. they are in the same scope the for loop is in. The result of this expression is discarded. Syntax for ([initialization]; [condition]; [final-expression]) statement page-9 PAGE-25 Often this is the case when working with arrays text += cars[0] + "<br>"; text += cars[1] + "<br>"; text += cars[2] + "<br>"; text += cars[3] + "<br>"; text += cars[4] + "<br>"; text += cars[5] + "<br>"; Different Kinds of Loops for - loops through a block of code a number of times for/in - loops through the properties of an object while - loops through a block of code while a specified condition is true do/while - also loops through a block of code while a specified condition is true 5.Operators, Arrays, standard objects and form processing in java:Operators:Simple answer can be given using expression 4 + 5 is equal to 9. Here 4 and 5 are called operands and + is called operator. JavaScript language supports following type of operators Arithmetic Operators Comparisons Operators Logical (or Relational) Operators Assignment Operators Conditional (or ternary) Operators. The Arithmetic Operators: Operator Description Example + Adds two operands A + B will give 30 - Subtracts second operand from the first A - B will give -10 * Multiply both operands A * B will give 200 / Divide numerator by enumerators B / A will give 2 % Modulus Operator and remainder of after an integer division B % A will give 0 ++ Increment operator, increases integer value by one A++ will give 11 -- Decrement operator, decreases integer value by one A-- will give 9 Page-26 JavaScript has the arithmetic operators +, -, *, /, and %. These operators function as the addition, subtraction, multiplication, division, and modulus operators, and operate very similarly to other languages. var a = 12 var b = 12 var c = 12 var d = 12 numbers. var e = 12 2. + * / 5; 5; 5; 5; // // // // 17 7 60 2.4 - division results in floating point % 5; // 2 - the remainder of 12/5 in integer math is Arrays in java scipts:The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects. Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. Neither the length of a JavaScript array nor the types of its elements are fixed. Since an array's size length grow or shrink at any time, JavaScript arrays are not guaranteed to be dense. In general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. Syntax [element0, element1, ..., elementN] new Array(element0, element1[, ...[, element]]) new Array(array Length) A JavaScript array is initialized with the given elements, except in the case where a single argument is passed to the Array constructor and that argument is a number. (See below.) Page-27 Note that this special case only applies to JavaScript arrays created with the Array constructor, not array literals created with the bracket syntax. Array Properties: Property Description constructor Returns a reference to the array function that created the object. index The property represents the zero-based index of the match in the string input This property is only present in arrays created by regular expression matches. length Reflects the number of elements in an array. prototype The prototype property allows you to add properties and methods to an Array Methods: Method Description concat() Returns a new array comprised of this array joined with other array(s) and/or value(s). every() Returns true if every element in this array satisfies the provided testing function. filter() Creates a new array with all of the elements of this array for which the provided filtering function returns true. forEach() Calls a function for each element in the array. indexOf() Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. join() Joins all elements of an array into a string. lastIndexOf() Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. map() Creates a new array with the results of calling a provided function on every element in this array. pop() Removes the last element from an array and returns that element. push() Adds one or more elements to the end of an array and returns the new length of the array. Page-28 Standard objects and form processing in java:The Document Object Model (DOM) is an application programming interface for valid HTML and well-formed XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated. In the DOM specification, the term "document" is used in the broad sense - increasingly, XML is being used as a way of representing many different kinds of information that may be stored in diverse systems, and much of this would traditionally be seen as data rather than as documents. Nevertheless, XML presents this data as documents, and the DOM may be used to manage this data. With the Document Object Model, programmers can build documents, navigate their structure, and add, modify, or delete elements and content. Anything found in an HTML or XML document can be accessed, changed, deleted, or added using the Document Object Model, with a few exceptions - in particular, the DOM interface for the XML internal and external subsets have not yet been specified. <TABLE> <TBODY> <TR> <TD>Shady Grove</TD> <TD>Aeolian</TD> </TR> <TR> <TD>Over the River, Charlie</TD> <TD>Dorian</TD> </TR> </TBODY> </TABLE> PAGE-29 JavaScript wears many hats. You can use JavaScript to create special effects. You can use JavaScript to make your HTML pages "smarter" by exploiting its decision-making capabilities. And you can use JavaScript to enhance HTML forms. This last application is of particular importance. Of all the hats JavaScript can wear, its form processing features are among the most sought and used. Nothing strikes more fear in the heart of a Web publisher than these three letters: C-G-I. CGI (which stands for common gateway interface), is a mechanism for safely transporting data from a client (a browser) to a server. It is typically used to transfer data from an HTML form to the server. With JavaScript at your side, you can process simple forms without invoking the server. And when submitting the form to a CGI program is necessary, you can have JavaScript take care of all the preliminary requirements, such as validating input to ensure that the user has dotted every i. In this column we'll look closely at the JavaScript-form connection, including how to use JavaScript's form object, how to read and set form content, and how to trigger JavaScript PAGE-30 events by manipulating form controls. We'll also cover how to use JavaScript to verify form input and sumbit the form to a CGI program Creating the form There are few differences between a straight HTML form and a JavaScript-enhanced form. The main one being that a JavaScript form relies on one or more event handlers, such as on Click or on Submit. These invoke a JavaScript action when the user does something in the form, like clicking a button. The event handlers. Typical form control objects -- also called "widgets" -- include the following: Text box for entering a line of text Push button for selecting an action Radio buttons for making one selection among a group of options Check boxes for selecting or deselecting a single, independent option