IT430 — Midterm Summary (Lectures 1–22)
📘 Lecture 1 — E-Commerce and its types, Internet and WWW Basics, Internet standards and protocols, IP addressing, Data communication on internet, Domain name system
📖 Overview: This lecture introduces the fundamental concept of electronic commerce (e-commerce), its various classifications based on the nature of transactions, and core networking basics. It explains the distinction between the Internet and the Web, the client-server model, and the stateless nature of HTTP, which is crucial for understanding how online transactions and user data logging work.
🗂️ Topics Covered
The lecture begins with a course outline and recommended books, then defines e-commerce and classifies it by transaction type: B2B, B2C, C2C, C2B, Intra-Business, and Non-Business EC. It then covers basic definitions of web client, server, browser, intranet, extranet, and internet, followed by the client-server model. The Web is defined as a protocol using HTTP, and the four-step HTTP process is explained, highlighting its stateless nature and the side effect of creating common log files.
📝 Lecture Summary
E-Commerce definition
Electronic commerce is an emerging concept that describes the process of buying and selling or exchanging of products, services and information via computer networks including the internet.
E-commerce classification
A common classification of EC is by the nature of transaction:
- Business-to-Business (B2B): electronic market transactions that take place between organizations
- Business-to-Consumer (B2C): retailing transactions with individual shoppers – typical shopper at Amazon.com is a consumer
- Consumer-to-Consumer (C2C): consumer sells directly to consumers, examples - individuals selling in classified ads, auction sites allowing individuals to put up items for auction – e.g., e-bay
- Consumer-to-Business (C2B): individuals who sell products or services to organizations and those who seek sellers and conclude a transaction
- Intra Business (organizational) EC: all internal organizational activities involving exchange of goods, services or information, selling corporate products to employees, online training and cost reduction activities
- Non-Business EC: academic institutions, not-for-profit organizations, religious/social organizations and government agencies using EC to improve their operations, customer service and reduce expense
Basic Definitions
- Web client: machine that initiates internet request
- Web server: machine that services internet request
- Browser: software at the client side to interact with web data
- Intranet: an internal network of computers confined to a single place
- Extranet: when two or more intranets are connected with each other, they form an Extranet – e.g, Virtual Private Network
- Internet: a global network of networks is defined as internet
The Internet presents a two-way client server communication model as shown in Fig. 1 below: Client-Server Model (Fig. 1 reference)
What is the WEB?
The Web is a protocol that uses the internet as the communication structure. It links documents stored in computers that communicate on the internet. It is based on Hypertext Transfer Protocol (HTTP) - native protocol of WWW designed for making web page requests.
HTTP is a four step process per transaction:
- Client makes an HTTP request for a web page, and makes a TCP/IP connection
- Server accepts request
- Server sends page as HTTP response
- Client downloads the page and Server breaks the connection
🔑 Definition — HTTP: Hypertext Transfer Protocol, the native protocol of the World Wide Web designed for making web page requests. It is a four-step process per transaction involving a client request and server response.
Side Effect of HTTP Transfers
A record is left of all web transaction in a file that resides at the server called common log file. Good news is that some user data (record of his visits to the web sites) is recorded in a particular format in the log files. Bad news is that user privacy is not maintained.
HTTP is stateless because in the fourth step the server breaks the connection. This means:
- Each operation or transaction makes a new connection
- Each operation is unaware of any other connection
- Each click is a new connection
📐 Stateless Protocol: HTTP is stateless because the server breaks the connection after each transaction, meaning each click establishes a new connection with no memory of previous interactions.
💡 Why this matters: The stateless nature of HTTP is a fundamental limitation for e-commerce. To maintain a shopping cart or user session across multiple page requests, additional technologies like cookies or server-side session management must be used to simulate statefulness.
What can you do with this data?
- Rearrange your site by knowing which portions of your web site are popularly accessed and which are ignored by the users
- Change your marketing strategy – e.g., you can introduce some promotional scheme for boosting the sale of ignored items
- Make a mailing list – you can trace the location from where customers are visiting and prepare a mailing list for marketing purposes
⭐ Key Takeaways
E-commerce is the exchange of products, services, and information via computer networks, classified primarily by transaction type (B2B, B2C, C2C, C2B, Intra-Business, Non-Business). The Internet is a global network of networks, while the Web is a protocol (HTTP) running on top of it. HTTP is stateless—each click creates a new, independent connection. This statelessness results in a common log file at the server, recording all transactions, which can be analyzed for site optimization and marketing, but raises privacy concerns. Understanding these basics is essential for grasping how e-commerce platforms operate and track user behavior.
🧠 Quick Revision Questions
- Define electronic commerce and list the six classifications of e-commerce by the nature of transaction.
- What is the difference between an intranet, an extranet, and the internet?
- Describe the four-step process of an HTTP transaction.
- What does it mean that HTTP is "stateless"? Give one practical consequence of this for e-commerce websites.
- What is a common log file, and what are two business uses of the data it contains?
📘 Lecture 2 — What Is a Network
📖 Overview: This lecture introduces the fundamental concept of computer networks, their purposes, and the layered models that govern how data is communicated across them. It explains both the conceptual OSI model and the practical TCP/IP stack used on the internet, culminating in a detailed discussion of IP addressing and its classes, which is essential for understanding how devices are identified and located on a network.
🗂️ Topics Covered
The lecture begins by defining a network and local area network (LAN) and listing reasons for networking. It then introduces network protocols and the ISO’s OSI model, describing each of its seven layers in detail from Application to Physical. The mapping between the OSI model and the four-layer TCP/IP internet stack is explained with a table of important protocols. Finally, the lecture covers IP addressing, including decimal-to-binary conversion, and the five classes of IP addresses (A, B, C, D, E) with the rules for identifying them and their network/host byte divisions.
📝 Lecture Summary
What is a Network
A network can be anything from a simple collection of computers at one location connected through a connectivity media to the internet (a global network of networks). A Local Area Network (LAN) is a server-based network confined to a particular area or place. Most LANs consist of many clients and a few servers.
Why networking your computer
We network our computers to share resources and communicate. Networking is done for:
- File sharing
- Hardware sharing – printer sharing, for example
- Program sharing
- User communication through a machine called e-mail server
Network protocol
Network protocols are those standard rules using which computers on a network communicate and exchange data with each other. A group of protocols that prepare the data for communication on the network is called the Protocol stack.
International organization for standard’s (ISO) model
In the 1970s, ISO’s OSI model was developed – a conceptual model for network communications. OSI stands for Open System Interconnection Reference Model and it proposes a 7 layer architecture. Each layer (except physical layer) at the sending machine sends instructions through its header to the receiving machine as to how the accompanying data be interpreted or treated. Header is a piece of information attached to the data at its beginning by each layer except the physical layer. The process of moving the data down the OSI Protocol stack at the sending machine is called Encapsulation, and the process of moving the data up the OSI stack at the receiving side is called De-encapsulation.
Application layer
It sits at the top of the OSI model. Requests related to file transfer and database queries are handled by this layer. Two very important protocols, namely, HTTP and FTP (file transfer protocol) operate at this layer.
Presentation layer
It is the translator of the OSI model. It provides instructions through its header that how the accompanying data should be formatted by the receiving machine. MIME - multipurpose internet mail extensions protocol operates at this layer to define file formats and data types.
Session layer
It provides instructions about the nature of communication link between the sending and receiving machine during a session. A combination of protocols called Session Protocol Data Units work at this layer. Three modes of communication are simplex, half-duplex and full-duplex. 🔑 Definition — Simplex: communication in one direction only. 🔑 Definition — Half-duplex: communication in two directions but one party can send data at a time. 🔑 Definition — Full-duplex: communication in two directions while both parties are able to send data simultaneously. It also places special checkpoints on data packets to trace any lost packets.
Transport layer
TCP (Transmission Control Protocol) or UDP (User Datagram Protocol) operate at this layer. It has two functions. It converts the data into data packets. Secondly, it is responsible for flow control of data. TCP is more reliable as it is acknowledgment based as opposed to UDP which does not use any system of acknowledgment for the delivery of data packets.
Network layer
It is responsible for providing IP addresses on data packets using IP protocol. Routing Information Protocol (RIP) also operates here which enables routers to build their routing table. Another protocol, Address Resolution Protocol (ARP) is also designed to operate at the network layer.
Data link layer
It places data packets into data frames. Network Interface Card Drivers/Protocols operate at this layer. It is used to identify MAC or hardware address of computer machines. A mathematical calculation, Cyclical Redundancy Check (CRC), takes place here to confirm integrity of data frames.
Physical layer
It has got no header. All information including the header information is converted into binary data at this layer. It results into the generation of electric signals as 1s and 0s are queued up and travel along the connectivity media to the receiving side.
Internet layers- TCP/IP stack
The internet communication model (TCP/IP Stack) proposes a 4 layer architecture. The layers map with the OSI model’s layers as follows:
- Application layer is equivalent to OSI model’s Application, Presentation and Session layers
- Host-to-Host Layer is equivalent to OSI model’s Transport layer
- Internet layer is equivalent to OSI model’s Network layer
- Network Access layer is equivalent to OSI model’s Data link layer
IP addressing
IP addressing is the logical addressing scheme used to identify computer machines on the internet. Each computer has a unique IP address provided by IP protocol for a given session. It is represented by four decimal numbers separated by a period, e.g., 140.57.220.200. Computers see this information as a stream of 32 bits.
Classes of IP address
There are five classes of IP addresses, namely, A, B, C, D and E. Classes A, B and C are for general public use, whereas Classes D and E are used by people belonging to certain special groups. To find which class a particular IP address belongs to, the rule is to look at the number in the first byte. If this number falls within the calculated range of a specific class, then we can say that this IP address belongs to that particular class.
By rule, in class A networks the first byte would refer to the network address and the remaining three bytes to the host machines on that network, providing a very large network. In class B, the first two bytes indicate the network address and the last two bytes indicate the host machines, giving a medium-sized network. In class C, the first three bytes refer to the network address and the last byte to the host machines, which would be a very small network.
💡 Why this matters: Understanding IP address classes is fundamental for network design, subnetting, and troubleshooting. It determines how many devices can be connected on a network and how network traffic is routed.
⭐ Key Takeaways
A network enables resource sharing and communication, guided by protocols that form a stack. The OSI model is a 7-layer conceptual framework for understanding network communication, where data is encapsulated (headers added) at each layer on the sender side and de-encapsulated (headers removed) at the receiver side. The practical TCP/IP stack has only 4 layers, mapping Application, Presentation, and Session into one, and Data Link into Network Access, with TCP (reliable) and UDP (unreliable) operating at the Host-to-Host/Transport layer. IP addressing is a 32-bit logical scheme represented in dotted decimal notation, and the first byte determines the class (A, B, C for public use; D, E for special groups) which dictates how many bytes are for the network versus host portion.
🧠 Quick Revision Questions
- What are the two main processes of moving data down and up the OSI protocol stack called?
- Which OSI layer is responsible for placing data into frames and performing a CRC check?
- How does the Host-to-Host layer in the TCP/IP stack map to the OSI model?
- Given an IP address of 200.10.5.1, which class does it belong to, and how many bytes represent the network portion?
- What is the key difference between TCP and UDP protocols at the Transport layer?
📘 Lecture 03 — How Many Class A, B, C Networks and Hosts Are Possible?
📖 Overview: This lecture covers the fundamentals of IP addressing structures, including the classification of networks into Class A, B, and C, along with their capacity limits. It also introduces essential networking concepts like subnet masks, the Domain Name System (DNS), name resolution processes, and the difference between IP and MAC addresses, which are crucial for understanding internet communication.
🗂️ Topics Covered
The lecture begins by explaining the number of possible class A, B, and C networks and the maximum hosts each can accommodate. It then defines the subnet mask and its role in identifying network and host portions of an IP address, providing default masks for each class. The discussion moves to IP version 6 as the successor to version 4, followed by a detailed explanation of the Domain Name System (DNS), including top-level domains (TLDs) and second-level domains (SLDs). The process of name resolution using Domain Name Servers is illustrated with examples, and the lecture concludes with an overview of how domain names and IP addresses are administered by organizations like ICAAN and the concept of the Media Access Control (MAC) address.
📝 Lecture Summary
HOW MANY CLASS A, B, C NETWORKS AND HOSTS ARE POSSIBLE?
There are 126 class A networks possible (0 and 127 are not used for general purposes). Each class A network can accommodate a maximum of 16 million hosts. There are 16384 class B networks possible, each hosting up to 65000 host machines. There are 2 million class C networks possible, each capable of accommodating up to 256 host machines.
🔑 Definition — Class A, B, C Networks: These are categories of IP addresses in IPv4, defined by the first octet, which determine the number of possible networks and hosts per network. 📌 Example: A single Class A network can theoretically support 16 million devices, while a Class C network can only support 256.
Subnet mask
An IP address is meaningless for computers unless it is accompanied by a subnet mask. It tells computer machines what part of the accompanying IP address corresponds to the network address and what part corresponds to the host machine on that network. A subnet mask is also represented by four decimal numbers separated by a period. Default subnet masks for class A, B, and C types of IP addresses are as follows:
- Class A: 255.0.0.0
- Class B: 255.255.0.0
- Class C: 255.255.255.0
💡 Why this matters: Without a subnet mask, a computer cannot distinguish between the network ID and the host ID, making routing impossible.
IP version
The existing IP scheme (version 4) is likely to be replaced by IP version 6. It would provide 128 bits IP addresses in hexadecimal format. According to an estimate, a total of 3.4 x 10³⁸ addresses would then be available.
🔑 Definition — IP Version 6 (IPv6): A newer version of the Internet Protocol designed to replace IPv4, using 128-bit addresses to vastly increase the number of available addresses.
📐 Formula: IPv6 Address Space = 2¹²⁸ = 3.4 x 10³⁸ addresses.
📌 Example: IPv6 addresses look like 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
Domain name system
A Domain Name is a user-friendly name used to locate a web site on the internet (e.g., vu.edu, bestcomputers.com). The Domain Name System (DNS) provides the structure and strategy used to refer to computers on the internet by these user-friendly names. Domain Names are unique and are assigned after one pays and registers for them. With the help of DNS, a domain name is translated into its corresponding IP address. A fully qualified domain name is processed from right to left for translation. It can be made up of a top level domain (TLD), second level domain (SLD), and subdomains. Seven popular TLDs are ".com", ".edu", ".org", ".gov", ".net", ".countryname", and ".int". SLDs represent the name of a company/institution/entity. Subdomains represent the geographical or functional units of a company/institution.
🔑 Definition — Fully Qualified Domain Name (FQDN): The complete domain name for a specific computer, or host, on the internet, specifying all domain levels.
📌 Example: In ecom.cs.vu.edu, .edu is the TLD, vu is the SLD, and cs and ecom are subdomains.
Name resolution
The translation or resolution of a fully qualified domain name into its IP address takes place using the hierarchy of special computer machines called Domain Name Servers. A DNS server is a server on the network that maintains a database/table containing the list of domain names and their corresponding IP addresses. The name servers for TLDs are also called Root Name Servers. There is a program called Resolver built into the browser, which sends the request for resolution of the domain name to a Local Name Server. The local name server then contacts the root name server, which looks into its database and where possible provides the IP address of the name server below in the hierarchy. Hence, in a similar number of steps, the fully qualified domain name is completely translated into the IP address of the web server.
💡 Why this matters: This hierarchical process allows the global DNS system to be scalable and manageable, preventing every server from needing to know every other server's IP address.
Getting domain names and IP addresses
Domain names are administered in a hierarchy. At the global level, the task of registration/administration of domain names is supervised by the organization called Internet Corporation for Assigned Names and Numbers (ICAAN). There are organizations working under ICAAN in different regions, such as APNIC for Asia and Pacific Rim, ARIN for America and South Africa, and RIPE-NCC for Europe and North Africa. Each of these are further connected to Internet Service Providers (ISPs) at the local level. One can register a domain name through an ISP. Similarly, one can lease IP addresses from a local ISP. ISPs can use a server to dynamically supply IP addresses to their clients for a session, called a DHCP (Dynamic Host Configuration Protocol) server.
🔑 Definition — DHCP Server: A network server that automatically assigns IP addresses and other network configuration parameters to devices on a network. 💡 Why this matters: DHCP automates IP address management, preventing conflicts and simplifying network administration.
Media access control (MAC) address
Data to be delivered on a network must be converted first into serial transmission. This is done through a device called a Network Interface Card (NIC) installed in a computer. The NIC has a 48-bit unique address printed on it called the MAC or hardware address of the computer. It consists of 12 hexadecimal characters and can have different formats, e.g., 090017A9B2EF, 09:00:17:A9:B2:EF, or 09-00-17-A9-B2-EF. While the IP address of a computer may change, its MAC address remains the same unless the NIC is replaced. There are 2⁴⁸ unique MAC addresses possible. The organization Institute of Electrical and Electronic Engineers (IEEE) administers the allocation of MAC addresses worldwide, ensuring no duplication by NIC manufacturers.
🔑 Definition — MAC Address: A unique hardware identifier assigned to a Network Interface Card (NIC) for use at the data link layer of a network segment.
📐 Formula: Total possible MAC addresses = 2⁴⁸.
📌 Example: 09:00:17:A9:B2:EF is a unique identifier for a specific network card, distinct from any IP address assigned to that computer.
⭐ Key Takeaways
A student must remember the precise number of networks and hosts for each IP class (126 Class A networks with 16 million hosts each, 16,384 Class B networks with 65,000 hosts, and 2 million Class C networks with 256 hosts). The subnet mask is critical for distinguishing the network and host portions of an IP address, with default masks (255.0.0.0 for A, etc.) being essential knowledge. The Domain Name System translates user-friendly names to IP addresses via a hierarchical process involving root and local name servers, and the fully qualified domain name structure consists of TLD, SLD, and subdomains. Finally, the MAC address is a permanent, 48-bit hardware identifier for a NIC, managed by IEEE, while IP addresses can be dynamic and are administered by organizations like ICAAN and its regional bodies.
🧠 Quick Revision Questions
- What are the default subnet masks for Class A, Class B, and Class C IP addresses?
- How many Class B networks are possible, and what is the maximum number of hosts each can support?
- Explain the role of a "Resolver" program in the name resolution process.
- What is the difference between a MAC address and an IP address?
- Name the global organization that supervises the registration and administration of domain names.
📘 Lecture 4 — NETWORKING DEVICES
📖 Overview: This lecture covers the physical layout and topological structures of Local Area Networks, alongside the hardware devices that enable and manage network communication. It explains how devices like hubs, bridges, switches, and routers function at different levels, and introduces cabling options and the role of ISPs in internet connectivity, which is fundamental for understanding e-commerce infrastructure.
🗂️ Topics Covered
The lecture begins by explaining LAN topologies (Bus, Star, Ring) and networking approaches (Server-based vs. Peer-to-Peer). It then details networking devices including Hubs, Repeaters, Bridges, Switches, and Routers, explaining their functions, how they manage traffic, and conserve bandwidth. The second half covers physical cabling options (copper, fiber optic, telephone/electrical) and wireless options (WiFi, Bluetooth, infrared, satellite). Finally, it introduces Address Resolution Protocols (ARP/RARP) and concludes with the hierarchical role of ISPs on the internet.
📝 Lecture Summary
Topology of a LAN means its physical lay out. There are three main types of Network Topology, namely, Bus Topology, Star Topology and Ring Topology as shown in Figures 1-3 below. There are two different approaches to networking – Server-based and Peer-to-Peer approach.
The physical layout of a Local Area Network is its topology, with three primary types: Bus Topology (all devices share a single cable), Star Topology (all devices connect to a central hub/switch), and Ring Topology (devices are connected in a closed loop). Networking approaches differ between Server-based networks, where a centralized server manages resources and serves user requests, and Peer-to-Peer networks, where all machines have equal capability and can act as both client and server.
Networking devices
Hubs provide a central connection point for a LAN, organizing cables and relaying data signals to all connected computers. They have ports on the back for connecting computers and come in various sizes and shapes. Hubs simply broadcast all data to every port without any intelligence.
Repeaters regenerate and amplify electric signals to extend the distance of a network. However, they have no capabilities for directing network traffic or filtering data.
Bridges
A Bridge is a combination of hardware and software with its own operating system. It helps conserve bandwidth, which is the speed of a network indicating how many bits can be transmitted in a given time. A bridge physically divides a larger network into smaller segments. It reads the MAC (Media Access Control) or physical address of a computer on data packets. This address is printed on the Network Interface Card. The bridge matches this MAC address with one stored in its table to determine which segment a packet belongs to, sending the packet only to that segment and preventing other segments' traffic from entering.
🔑 Definition — MAC Address: A unique physical address printed on the Network Interface Card that identifies a device on a local network.
📌 Example: In a network with two segments (Segment A and Segment B), a bridge separates them. If Computer X in Segment A sends data to Computer Y also in Segment A, the bridge reads the MAC address, sees it belongs to Segment A in its table, and only forwards the packet within Segment A. Packets from Segment B are not allowed into Segment A, thus conserving bandwidth.
💡 Why this matters: Bridges reduce unnecessary traffic by ensuring data only travels within its relevant network segment.
Switches
A Switch is also a combination of hardware and software with its own operating system, used to increase network bandwidth. However, a switch virtually divides a network into small segments called Virtual LANs or VLANs. Similar users can be grouped into a VLAN without physical proximity. A switch reads the MAC address on a packet and matches it with its list of MAC addresses, sending the packet only to the specific machine on the relevant VLAN. Packets from other VLANs are blocked from entering a particular VLAN, increasing bandwidth.
🔑 Definition — VLAN (Virtual LAN): A logical grouping of devices on a network that are segmented by function or user type rather than physical location.
Routers
Routers use hardware and software to forward data packets to their destination on the internet. They are more efficient and sophisticated than bridges and switches. Routers divide large networks into logical segments called Subnets based on IP addressing schemes. A router communicates with other routers using the Routing Information Protocol to build a routing table. This table contains information about different network addresses and routes for delivery. A router is a decision-making device that reads network addresses from the IP address on a data packet and determines the shortest possible path for delivery.
🔑 Definition — Subnet: A logical subdivision of an IP network, created by dividing a network into smaller, manageable segments.
📌 Example: Client machine 'A' on network 140.57 wants to send data to web server 'B' on network 100. Router R1, attached to network 140.57, consults its routing table. It finds the shortest path is to forward data to Router R2, attached to network 100. If R1-R2 is blocked, R1 finds the alternative shortest path: R1-R3-R4-R2.
Cabling options
Copper-based cables are common for connecting computers, with two main types: coaxial and twisted pair. Twisted pair has two options: Unshielded Twisted Pair (UTP) and Shielded Twisted Pair (STP). Fiber optic cables are used on the internet, delivering data at very high speed using glass or plastic filaments and pulses of light. Telephone and electrical wire networks can also be used for connectivity. Wireless options include radio connectivity (WiFi, Bluetooth), infrared connectivity, and Satellite microwave transmissions.
Address resolution protocols (ARP) and Reverse address resolution protocol (RARP)
Each computer on the internet creates a list of its IP address and corresponding MAC address using ARP (Address Resolution Protocol). Through RARP (Reverse Address Resolution Protocol), this information is forwarded to a network server. When a data packet arrives at the destination router, it inquires about the corresponding MAC address from the network server, inserts it, and delivers the packet to that MAC address. A data packet therefore needs both IP and MAC addresses to reach its destination.
🔑 Definition — ARP: Protocol that resolves an IP address to its corresponding MAC address on a local network.
Role of ISPs on internet
Internet Service Providers (ISPs) are organizations that provide internet connections and offer services like web hosting, newsgroups, and email. They work in a hierarchy. The ISP at the top, connected to the internet backbone, is called an Internet Access Provider (IAP). An internet trunk line or backbone passing through a metropolitan area is called a Metropolitan Area Ethernet (MAE). IAPs connect to MAEs at points called Network Access Points (NAPs). Trunk lines allow IAPs to move data, and actual routing of data packets takes place on the internet backbone.
🔑 Definition — IAP (Internet Access Provider): An ISP at the top of the hierarchy directly connected to the internet backbone.
🔑 Definition — MAE (Metropolitan Area Ethernet): An internet backbone trunk line passing through a metropolitan area.
🔑 Definition — NAP (Network Access Point): The points where IAPs connect to MAEs.
⭐ Key Takeaways
This lecture is critical for understanding how networks are physically and logically organized. The three fundamental LAN topologies (Bus, Star, Ring) and the two networking approaches (Server-based vs. Peer-to-Peer) form the basis of network design. Each networking device has a distinct role: Hubs broadcast data, Repeaters amplify signals, Bridges and Switches conserve bandwidth by segmenting networks (physically and virtually, respectively), and Routers make intelligent path decisions on the internet using routing tables. You must remember that Bridges use MAC addresses to divide a network into physical segments, while Switches create VLANs, and Routers use IP addresses to create Subnets. Finally, ARP/RARP protocols link IP and MAC addresses, and ISPs operate in a hierarchy with IAPs, MAEs, and NAPs to provide internet connectivity.
🧠 Quick Revision Questions
- What is the main difference between a Bridge and a Switch in terms of network segmentation?
- How does a Router determine the best path for a data packet to reach its destination?
- Explain the difference between ARP and RARP protocols.
- What is the role of an Internet Access Provider (IAP) in the ISP hierarchy?
- Name the three major LAN topologies and briefly describe how devices are connected in each.
📘 Lecture 5 — Basics of HTML
📖 Overview: This lecture introduces the fundamentals of email protocols and HTML (Hypertext Markup Language) for creating web documents. Students learn how to structure a basic web page, format text, create lists, and apply images — essential skills for e-commerce web development.
🗂️ Topics Covered
Email protocols (SMTP, POP3, IMAP), HTML document structure with tags and attributes, text formatting tags (p, b, i, u, big, small), font tag properties, heading levels, steps for creating a basic HTML page, ordered and unordered lists with list types, applying and downloading images with img tag attributes.
📝 Lecture Summary
Email Protocols
Email addresses like john@hotmail.com are delivered by first translating the domain part (hotmail.com) into the IP address of the email server through DNS. Messages are stored in user accounts on the email server. Three common protocols are used: Simple Mail Transfer Protocol (SMTP) for sending messages between servers (message uploads), Post Office Protocol 3 (POP3) for retrieving messages by downloading them to the client machine and then deleting them from the server, and Internet Message Access Protocol (IMAP) which also retrieves messages but does not delete them from the server, allowing access from multiple locations. POP3 and IMAP must be configured with SMTP for full email functionality.
🔑 Definition — DNS (Domain Name System): Translates domain names (like hotmail.com) into IP addresses of the corresponding server. 💡 Why this matters: Understanding these protocols is essential for configuring email systems in e-commerce platforms.
Hypertext Markup Language
Web documents are defined by Hypertext Markup Language (HTML), which is a language of tags. A tag is a special letter or keyword enclosed in angular brackets (< >). Most tags have corresponding closing tags represented by the same keyword preceded by a slash (/). HTML is case independent and has a fixed number of tags and attributes — specific words/letters prescribed for certain tags with possible values. The browser reads/interpreters each tag and its attributes to display results. View source code using the "View Source" option in the browser menu.
An HTML document starts with <HTML> tag and its closing </HTML>. The entire content is contained within a <body> tag pair. A <head> tag can be used before the body to provide title and other information. Example structure:
<HTML>
<HEAD>
<TITLE>My first page</TITLE>
</HEAD>
<BODY>
A simple page with just this sentence
</BODY>
</HTML>
Text Formatting
The paragraph tag <p> can include an align attribute with values Center, Left, or Right. <br> tag provides a line break. <center> aligns text in the center. Text formatting tags include:
<b></b>for bold text<i></i>for italic text<u></u>for underlined text<big></big>for larger font size<small></small>for smaller font size
🔑 Definition — Tag: A special keyword enclosed in angular brackets that defines how content is displayed.
Font Tag
The font tag defines various font properties with attributes Size, Face, and Color. Attributes can be used simultaneously, for example: <font size=5 color=red face=Arial>internet and e-commerce</font>. Font size specifies text size, face specifies the font family, and color specifies text color.
Example code showing multiple formatting:
<HTML>
<HEAD></HEAD>
<BODY>
<H1>This is my main title</H1>
<p>Here is the first paragraph. This is some <b><i>bold text</i></b></p>
<p><font face="Arial">This text is in the Arial font.</font>
</BODY>
</HTML>
Heading in HTML
Six different levels of headings can be created, from largest to smallest:
<H1>Level 1 – largest text</H1><H2>Level 2</H2><H3>Level 3</H3><H4>Level 4</H4><H5>Level 5</H5><H6>Level 6 – smallest text</H6>
Creating Basic HTML
Steps for creating/viewing a web page:
- Open a text editor like Notepad or WordPad
- Type the HTML code
- Save as a "text" file with
.htmlextension (e.g., filename.html) - Start a browser
- Open the file through File menu -> Open
- Browse to find the file, click Open and OK
- To make changes: go back to the text editor, make changes and SAVE
- Go back to browser, reload using 'Refresh' icon, 'Refresh' button in View menu, or F5 key
List in HTML
<UL></UL> creates an unordered list (bulleted), while <OL></OL> creates an ordered list (numbered). Use <LI></LI> tags between them for each list item. Example:
<UL>
<LI>Item1</LI>
<LI>Item2</LI>
<LI>Item3</LI>
</UL>
<P>
<OL>
<LI>Item1</LI>
<LI>Item2</LI>
<LI>Item3</LI>
</OL>
The <hr> tag creates a horizontal line with attributes Width, Size, Align, and Noshade. Both <hr> and <br> tags do not have closing tags. Unordered lists can use Type attribute with values Square, Disc, or Circle. Ordered lists can use Type attribute with values a (lowercase letters), A (uppercase), i (small Roman numerals), I (large Roman numerals), or default 1,2,3.... Example: <OL Type="a"><LI>First></LI><LI>second</LI></OL>
Applying Images in HTML
Use the <img> tag with src attribute containing the image file name to display images. The browser displays the image where the <img> tag appears in code. Common image formats are .gif and .jpg. Additional attributes include Width and Height (specifying image size) and Align (specifying position on the page). Example: <Img Src="cassette.gif" width="80%" height="50%" Align="Middle">
To download an image from the web:
- Right-click on the image
- Choose 'Save Picture' or 'Save Picture As'
- Rename if desired (but cannot change file type)
- Save preferably in the same folder as the HTML document
- Reference the image in HTML using
<img>tag
📌 Example: <Img Src="cassette.gif"> displays the cassette.gif image at the point where the tag appears in the code.
🔑 Definition — Attribute: A property within an HTML tag that defines additional characteristics or behaviors (e.g., align, size, src).
⭐ Key Takeaways
Students must understand that HTML is a tag-based language with fixed tags and attributes, where most tags have closing tags (except self-closing ones like <br> and <hr>). The three email protocols serve different purposes: SMTP for sending, POP3 for downloading with deletion, and IMAP for accessing without deletion. Creating a web page requires saving text files with .html extension and refreshing the browser after edits. Lists can be unordered (UL) with different bullet types or ordered (OL) with different numbering systems. Images are applied using the <img> tag with src attribute, and images should be saved in the same folder as the HTML document for easy referencing.
🧠 Quick Revision Questions
- What are the three common email protocols and what is the main difference between POP3 and IMAP?
- What is the basic structure of an HTML document? List all required and optional tags in order.
- How do you create an ordered list with lowercase letters in HTML?
- What attribute would you use to change the font face and color of text in HTML?
- What are the steps to download an image from the web and use it in your own HTML page?
📘 Lecture 06 — Basics of HTML
📖 Overview: This lecture covers the foundational concepts of HTML, focusing on hyperlinks, page styling with colors and backgrounds, meta information for search engine optimization, table creation and formatting for layout, and form design for user input. Understanding these elements is crucial for building functional and well-structured web pages.
🗂️ Topics Covered
The lecture begins with hypertext links using the anchor tag and mailto links, then moves to changing page colors using bgcolor, text, and link attributes, and meta information in the head section. It then covers tables including basic tags, spanning cells with colspan and rowspan, and table and cell attributes, followed by using tables for page layout. Finally, it introduces forms with submit/reset buttons, text boxes, text areas, checkboxes, radio buttons, and lists.
📝 Lecture Summary
Hypertext links
Hypertext links connect HTML documents. Text or images can be links, and links can be used for email as well. The href attribute is used in the anchor tag <A>, and its value is set as the URL of a web page or a file name. Content enclosed between <A> and </A> becomes clickable.
🔑 Definition — Anchor Tag: <A HREF="URL">clickable content</A> creates a hyperlink to a specified URL.
📌 Example:
<HTML>
<BODY>
<H1>Computer Science</H1>
Welcome to <A HREF=http://www.vu.edu>Virtual University</A> in Pakistan
</BODY>
</HTML>
This creates a clickable link labeled "Virtual University" that opens http://www.vu.edu.
To create a mailto link: <A HREF=mailto:vtv@hotmail.com> email address</A>
Changing colors in a page
To provide a specific background color to a web page, the bgcolor attribute is used in the body tag. The text attribute assigns font color to text, and the link attribute assigns color to hyperlinks. Color values can be color names (e.g., "Green") or six-digit RGB hexadecimal codes (e.g., #00FF00 for pure green). The RGB rule is: Red Green Blue. The background attribute provides an image as the page background.
📐 Formula — RGB Color Code: #RRGGBB where RR, GG, BB are two-digit hexadecimal numbers representing Red, Green, and Blue intensities.
📌 Example:
<HTML>
<BODY bgcolor=yellow text=red link=blue>
<H1>Computer Science</H1>
Welcome to <A HREF=http://www.vu.edu>Virtual University</A> in Pakistan
</BODY></HTML>
This creates a page with yellow background, red text, and blue hyperlinks.
💡 Why this matters: Controlling page colors and backgrounds is essential for branding, readability, and user experience.
Meta information
Meta information is information about the web page content, located in the <HEAD> section of HTML documents. It helps search engines locate documents. The Meta tag is used within the head tag for this purpose.
🔑 Definition — Meta Tag: <Meta name="description" content="..."> and <Meta name="keyword" content="..."> provide metadata about the page.
📌 Example:
<html>
<head>
<title>Introduction to e-commerce</title>
<Meta name="description" content="E-commerce is a newly emerging field that uses internet as a medium of communication">
<Meta name="keyword" content="e-commerce, internet, medium, communication">
</head>
<body>Page goes here</body></html>
This provides search engines with a description and keywords for the page.
Tables
Tables are used for page layout and displaying information systematically. Any content that can go in the body can go inside a table. Tables are built row-by-row from top to bottom.
Basic tags: The <Table> tag encloses the entire table. <TR> (table row) creates a row. <TD> (table data) divides a row into cells. <TH> (table header) labels columns as headings. <caption> provides a table caption.
📌 Example (2 row, 2 column table):
<Table Border=1>
<TR><TD>Cell1</TD><TD>Cell2</TD></TR>
<TR><TD>Cell3</TD><TD>Cell4</TD></TR>
</Table>
This produces a table with cells: Cell1, Cell2, Cell3, Cell4.
Spanning text across multiple rows or columns: The colspan attribute extends a cell across multiple columns. The rowspan attribute extends a cell across multiple rows.
📌 Example (Colspan):
<TABLE BORDER="1" align=center>
<CAPTION>Spanning the text</CAPTION>
<TR><TD COLSPAN="2">This line is extended to two columns</TD><TD>This does not</TD></TR>
<TR><TD>First Column</TD><TD>Second Column</TD><TD>Third Column</TD></TR>
</TABLE>
The first cell in the first row spans two columns.
📌 Example (Rowspan):
<TABLE BORDER="1">
<CAPTION>Example - ROWSPAN</CAPTION>
<TR><TD ROWSPAN="2">This line is stretched to two rows</TD><TD>First Row</TD></TR>
<TR><TD>Second Row</TD></TR>
<TR><TD>This does not</TD><TD>Third Row</TD></TR>
</TABLE>
The first cell in the first row spans two rows.
Table tag attributes:
- Border:
<table border="5">displays cell boundaries accordingly. - Width:
<table width="75%">sets table width. - Height:
<table height="100%">sets table height. - Cellpadding:
<table cellpadding="10">refers to distance between cell boundaries and content (pixels). - Cellspacing:
<table cellspacing="5">refers to distance between cells (pixels). - Color:
<table bgcolor="#cccccc">provides background color; can also use color name orbackgroundattribute for an image.
Attributes for <TD> tag:
- Width:
<td width="50%">specifies cell width relative to table width. - Align:
<td align="center">horizontally aligns text (left/right also valid). - Valign:
<td valign="top">vertically aligns text (bottom/middle also valid).
Using a table to set up a page with a margin
Set the table's height to 100% using the <table> tag's height attribute. The first column acts as the margin using bgcolor or background. The second column contains regular text and graphics.
📌 Example:
<HTML>
<HEAD><TITLE>A Page with a Left-Hand Margin</TITLE></HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<TABLE HEIGHT="100%">
<TR>
<TD BACKGROUND="image2.gif" WIDTH="100"> </TD>
<TD VALIGN="TOP">This section contains the contents of your web page.</TD>
</TR>
</TABLE>
</BODY></HTML>
is the HTML code for a blank space.
Forms
A form is a web page with text boxes, drop-down lists, and command buttons to get user information. Its basic tag is <form> and </form>. Two attributes are used: action (URL or file to send data to) and method (how data is sent, e.g., "post").
🔑 Definition — Form: <Form action="URL" method="post">...</Form> creates an interactive form for user input.
Types: Submit/Reset buttons, Text boxes, Text area, Check boxes, Radio buttons, Lists.
Submit and reset button: <Input type="submit" value="label"> and <Input type="Reset" value="label">. When the submit button is clicked, form data is sent to the URL specified in the <form> tag's action attribute. "Label" is the text on the button; the value attribute is optional.
Text boxes and text area: A text box uses <Input type="text">. A text area uses <Textarea> and </Textarea> with attributes cols and rows to set size. The name attribute in input and textarea tags provides a unique name for the field, used by the server side to respond.
📌 Example:
<FORM ACTION="http://www.gov.pk/scritps/test.asp" METHOD="POST">
First Name: <INPUT TYPE="TEXT" NAME="First"><P>
Last Name: <INPUT TYPE="TEXT" NAME="Last"><P>
Today's <I>Burning Question</I>: <B>How to make Pakistan a developed country?</B><P>
Please enter your answer in the text area below: <BR>
<TEXTAREA NAME="Answer" ROWS="10" COLS="60"></TEXTAREA><P>
<INPUT TYPE="SUBMIT" VALUE="I Know!"> <INPUT TYPE="RESET">
</FORM>
This creates a form with two text boxes, a text area for an answer, a submit button labeled "I Know!", and a reset button.
💡 Why this matters: Forms are essential for collecting user data, enabling interactive web applications like search, sign-ups, and feedback.
⭐ Key Takeaways
The key points to remember from this lecture include: hyperlinks are created using the <A> tag with the href attribute, and mailto links enable email communication. Page colors and backgrounds can be set using bgcolor (with names or RGB hex codes), text, link, and background attributes in the <BODY> tag. Tables are built row-by-row using <TABLE>, <TR>, and <TD> tags, with colspan and rowspan for spanning cells, and attributes like border, width, cellpadding, and cellspacing for formatting. Forms use the <FORM> tag with action and method attributes to send user data to a server, and include input types like text, submit, reset, and textarea. The code is used for blank spaces, and the name attribute in form fields is crucial for server-side processing.
🧠 Quick Revision Questions
- What is the purpose of the
hrefattribute in an anchor tag, and how is it used to create a mailto link? - How can you set a background color in HTML, and what are the two ways to specify the color value?
- What is the difference between
colspanandrowspanattributes in a<TD>tag? - What are the
actionandmethodattributes in a<form>tag, and what do they control? - Explain the purpose of the
nameattribute in form input fields, and provide an example of its use.
📘 Lecture 07 — TEXT BOXES, CHECK BOXES, RADIO BUTTONS
📖 Overview: This lecture covers essential HTML form input elements for collecting user data. It explains how to create text boxes, checkboxes, radio buttons, and selection lists, detailing their attributes and behaviors to enable interactive web forms.
🗂️ Topics Covered
The lecture covers four main types of HTML form input controls: text boxes with attributes like value, size, and maxlength; checkboxes for multiple selections using the checked attribute; radio buttons for single-choice options with shared Name attributes; and selection lists created with <select> and <option> tags, including drop-down and scrolling lists with Multiple and Selected attributes.
📝 Lecture Summary
Text Boxes
Text boxes are created using <input type=text>. The value attribute pre-fills the text box with default information (e.g., value=http://). The size attribute controls the width of the text box (e.g., size="40" creates a wider box). The maxlength attribute limits the maximum number of characters a user can type (e.g., maxlength="3" allows only three characters).
🔑 Definition — Text box: An HTML input element that allows users to enter a single line of text.
📐 Formula: <input type=text Name="fieldname" [Value="default"] [Size="width"] [Maxlength="maxchars"]> → Creates a single-line text input field.
📌 Example: <Input type=text Name="address" size="40"> creates a text box approximately 40 characters wide. <input type=text Name="age" maxlength="3"> creates a box where users can type a maximum of 3 characters (e.g., for age input).
Check Boxes
Check boxes are used for yes/no or true/false responses, allowing multiple selections. They are created with <input type=checkbox>. The checked attribute displays certain options as pre-selected. Each checkbox must have a unique Name attribute for identification when the form is submitted.
🔑 Definition — Check box: An HTML form element that allows users to select one or more independent options from a set.
📐 Formula: <input type="CHECKBOX" Name="fieldname" [Checked]> → Creates a selectable checkbox, optionally pre-checked.
📌 Example: In the phobia survey form, <INPUT TYPE="CHECKBOX" NAME="Flying" Checked> creates a pre-checked "Fear of flying" option, while other fears like "Water" and "Lock" remain unchecked by default.
Radio Buttons
Radio buttons allow users to select exactly one option from a group. All radio buttons in the same group share the same Name attribute value. Each option has a unique value attribute that specifies the data sent when that option is selected.
🔑 Definition — Radio button: An HTML form element that lets users choose a single option from a predefined set of mutually exclusive choices.
📐 Formula: <input type="radio" Name="groupname" Value="uniquevalue" [Checked]> → Creates a radio button in a group where only one can be selected.
📌 Example: In the income survey, three radio buttons share Name="Income" with Value="Poverty", Value="Middle" (pre-selected with Checked), and Value="Upper". Similarly, the political inclination group uses Name="Politics" with four options: Nationalist (pre-checked), Socialist, Republican, and None.
💡 Why this matters: Radio buttons enforce mutually exclusive choices, making them ideal for single-answer survey questions where the user must pick exactly one option.
Selection Lists
Selection lists are created with the <select> tag and contain <option> tags for each list item. The size attribute determines the number of visible items; omitting size creates a drop-down list, while size="2" or more creates a scrolling list with scroll bars. The Selected attribute marks a default choice, and the Multiple attribute allows users to select several items at once.
🔑 Definition — Selection list: An HTML form element that displays a list of options in a compact drop-down or scrollable box.
📐 Formula: <select name="fieldname" size="n" [Multiple]> <option [Selected]>item1</option> ... </select> → Creates a selection list.
📌 Example: The nationality list uses <SELECT NAME="Nationality" SIZE="4"> to show four items at a time with scroll bars; "Pakistani" is pre-selected using <OPTION SELECTED>Pakistani</OPTION>. The favorite city list omits size, creating a drop-down with "Lahore" pre-selected. The countries visited list uses <SELECT NAME="Countries" SIZE="5" MULTIPLE> to allow selecting multiple countries (e.g., Canada, Russia, England) by holding the Ctrl key (or Command on Mac).
⭐ Key Takeaways
The most critical concepts from this lecture are understanding the four core input types for HTML forms. Text boxes use name, value, size, and maxlength attributes to control input. Checkboxes allow multiple selections and use checked for defaults, with each needing a unique name. Radio buttons enforce a single choice within a group by sharing the same name but having distinct value attributes. Selection lists offer either a drop-down (no size attribute) or a scrolling list (with size ≥ 2), and optionally support multiple selections with the multiple attribute. Remember that for radio buttons, the value attribute is mandatory because it defines the data submitted when that option is selected.
🧠 Quick Revision Questions
- What attribute would you add to a text box to limit user input to exactly 5 characters?
- How do you make a checkbox appear pre-selected when the page loads?
- In a group of radio buttons, what attribute must be identical for all buttons to ensure only one can be selected?
- How do you create a drop-down list instead of a scrolling list using the
<select>tag? - Which attribute allows a user to select multiple items from a single selection list?
📘 Lecture 08 — FRAMES AND IMAGES IN HTML
📖 Overview: This lecture explains how to use frames in HTML to display multiple pages simultaneously within a single browser window. It also covers how to make images clickable as links and how to create image maps with multiple clickable regions defined by coordinates. Understanding these concepts is essential for creating more interactive and navigable web layouts.
🗂️ Topics Covered
The lecture covers the concept of frames using <FRAMESET> and <FRAME> tags, including dividing the screen horizontally and vertically, and nesting frames. It also covers making images clickable as links, and provides a detailed three-step process for creating image maps using <Map>, <Area>, and <IMG> tags, including determining coordinates using the ISMAP attribute.
📝 Lecture Summary
Frames in HTML
The concept of frames is used to set up a site so that one page remains in view in part of the browser screen while the visitors can use the rest of the screen to view other pages using hyperlinks. This concept uses two different types of pages: a frameset page and content pages. The frameset page divides the browser window into a set of frames and defines the size of each frame; it has no body section (no <body> tag). Content pages are just regular HTML pages.
Dividing the screen horizontally
The <FRAMESET> tag uses the ROWS attribute to divide the screen horizontally. The example <FRAMESET ROWS="25%,75%"> creates two frames stacked vertically.
🔑 Definition — Frameset Page: A page that divides the browser window into frames and specifies which content pages are displayed in each frame. It uses <FRAMESET> and <FRAME> tags and has no <BODY> tag.
📐 Formula: <FRAMESET ROWS="value1, value2, ..."> → Defines the height of each horizontal frame, either as a percentage of the total window height or in pixels.
📌 Example: The code <FRAMESET ROWS="25%,75%"> with two <FRAME> tags creates a layout where the top frame takes up 25% of the screen height and the bottom frame takes up 75%.
Dividing the screen vertically
The <FRAMESET> tag uses the COLS attribute to divide the screen vertically.
📐 Formula: <FRAMESET COLS="value1, value2, ..."> → Defines the width of each vertical frame, either as a percentage of the total window width or in pixels.
📌 Example: The code <FRAMESET COLS="20%,60%,20%"> creates three vertical columns, with the middle column being the widest.
Frames with content
The <FRAME> tag uses the SRC attribute to specify which HTML file is displayed in that frame. The NAME attribute is used to give the frame a unique identifier, which can be used with the TARGET attribute of a hyperlink to control where the linked page opens.
🔑 Definition — SRC attribute: Specifies the URL of the content page to be displayed in a frame.
🔑 Definition — TARGET attribute: An attribute of the <A> tag that specifies the frame in which the linked document should open. Its value must match the NAME attribute of a <FRAME> tag.
📌 Example: <FRAMESET ROWS="25%,75%"> <FRAME SRC="1.htm" NAME="upper"> <FRAME SRC="2.htm" NAME="lower"> </FRAMESET>. Then, a link in 2.htm with TARGET="lower" will load the new page into the frame named "lower".
Ready-made names for frames
There are four pre-defined target names that do not require a corresponding frame to exist.
Target="_self"– loads the new page into the same frame that contains the link.Target="_top"– loads the new page into the entire window, breaking out of any frame structure.Target="_blank"– loads the new page into a new browser window.
Some frame attributes
Several attributes can be added to the <FRAME> tag to control its appearance and behavior.
🔑 Definition — NORESIZE: An attribute used in the <FRAME> tag that prevents users from resizing the frame by dragging its border.
🔑 Definition — SCROLLING: An attribute that determines whether a scroll bar appears with a frame (e.g., SCROLLING="yes" makes it appear).
🔑 Definition — BORDER or FRAMEBORDER: Setting this attribute to 0 in the <FRAMESET> tag hides the border between frames.
Nesting frames
A frame can be further divided into different frames. This concept is called nesting of frames. A <FRAMESET> tag can be used inside another <FRAMESET> tag to create more complex layouts.
📌 Example:
<FRAMESET ROWS="25%,75%">
<FRAME SRC="1.htm" NAME="upper">
<FRAMESET COLS="50%,50%">
<FRAME SRC="2.htm" NAME="lower">
<FRAME SRC="3.htm" NAME="right">
</FRAMESET>
</FRAMESET>
This code creates a horizontal split where the bottom frame is further split into two vertical frames.
Images can be links, too
Images can be made clickable by placing an <IMG> tag inside an <A> tag. The entire image then becomes a hyperlink.
📌 Example: <A HREF="main.htm"><IMG SRC="home.gif"></A> — Clicking the "home.gif" image will load the file "main.htm".
Images can be maps, too
An image map is a web page graphic with several defined 'clickable' areas. Creating one involves three steps.
🔑 Definition — Image Map: A single image on a web page that contains multiple clickable regions, each linked to a different destination.
Step 1: Determine the map coordinates
A pixel is a point on a computer screen, identified by its column number followed by its row number. To find the coordinates of a region, you can load the image in a browser with the <ISMAP> attribute. The image coordinates of the current mouse position appear in the status bar.
📌 Example: For a 600 pixel wide, 100 pixel tall image divided into three equal areas:
- Area A: upper-left
0,0to lower-right199,99 - Area B: upper-left
199,0to lower-right399,99 - Area C: upper-left
399,0to lower-right599,99
Step 2: Use <Map> to define the image map
The <Map> tag is used to define a set of clickable areas. Inside it, the <Area> tag defines each region with its shape, coordinates, and target link.
📌 Example:
<Map Name="Testmap">
<Area shape="Rect" coords="0,0,199,99" href="a.htm">
<Area shape="Rect" coords="199,0,399,99" href="b.htm">
<Area shape="Rect" coords="399,0,599,99" href="c.htm">
</Map>
Step 3: Add the image map to the web page
The <IMG> tag uses the usemap attribute to link the image to the map defined in step 2. The value must be the name of the map preceded by a #.
📌 Example: <Img src="coords.gif" usemap="#Testmap"> — This assigns the image "coords.gif" to the image map named "Testmap".
<Area> tag’s SHAPE attribute
The shape attribute can have values like "rect", "circle", and "poly". For a circle, the coords attribute takes three values: the x-coordinate of the center, the y-coordinate of the center, and the radius. For a polygon, it takes three or more sets of x,y coordinates.
💡 Why this matters: The shape attribute allows you to define non-rectangular clickable areas, such as circular buttons or irregularly shaped regions in a map, making the image map more versatile.
⭐ Key Takeaways
The most critical concepts from this lecture are that frames divide the browser window using <FRAMESET> with ROWS or COLS, and each frame loads a separate HTML file using the <FRAME> tag's SRC attribute. The TARGET attribute in hyperlinks controls which frame a link opens in, and you can nest framesets for complex layouts. For images, you can make them links by wrapping them in an <A> tag, or create image maps using <Map> and <Area> tags with defined coords and shape values. Finally, images become active image maps when you add the usemap attribute to the <IMG> tag, referencing the map by name.
🧠 Quick Revision Questions
- What is the difference between a frameset page and a content page, and which tag is used to define each?
- If you have a link in a frame named "content" with the code
<A HREF="newpage.htm" TARGET="top">, where will "newpage.htm" open? - Write the HTML code to create a horizontal frame layout where the top frame is 150 pixels high and the bottom frame takes the remaining space.
- In an image map, what does the coordinate set "30,40,80,100" represent for a rectangular shape?
- What is the purpose of the
ISMAPattribute in the<IMG>tag when creating an image map?
📘 Lecture 9 — TAG ATTRIBUTES, SOUND FILES, ANIMATIONS
📖 Overview: This lecture covers specialized HTML elements and attributes, including
<area>tag attributes for image maps, embedding sound files, creating animated GIFs, using the<marquee>tag for scrolling text, and introduces Cascading Style Sheets (CSS) with four different implementation methods. These concepts enable developers to create more interactive and visually appealing web pages.
🗂️ Topics Covered
The lecture covers <area> tag attributes like alt, target, and nohref; sound file formats (AU, WAV, MP3, MIDI) and embedding methods using <embed> and <bgsound> tags; creation and use of animated GIF images; the <marquee> tag and its various attributes for controlling text scrolling; and an introduction to Cascading Style Sheets (CSS) including embedded, linked, and inline styling methods.
📝 Lecture Summary
<Area> tag attributes
The alt attribute is used to label the clickable region of an image map. The target attribute can be used to display the result in a given frame. The nohref attribute can be used to make a region non-clickable.
🔑 Definition — nohref: An attribute that makes a region in an image map non-clickable, meaning it does not link to any destination.
📌 Example: <Area shape="circle" coords="70,45,25" href="a.htm" alt="a.htm" target="upper" nohref>
Sound Files
Sound file formats covered are: AU, WAV, MP3, MIDI. Sound files can be used in an anchor tag as follows: <A href="song.wav">Click here for some greeting!</A>. We can also embed such files using the <embed> tag.
📌 Example - Embedding:
<HTML>
<HEAD><TITLE>Example - Embedding</TITLE></HEAD>
<BODY>
Click the Play button for some nice music:<BR>
<EMBED SRC="Skylar.MP3">
</BODY>
</HTML>
The <EMBED> tag also supports these attributes: Autostart="False" – browser does not play the sound file automatically when the user surfs the web page; Loop="value" – tells the browser how many times to play the file (you can set the value as a number or infinite); Hidden="True" – browser hides the control panel. There is another tag for embedding sound files: the <BGSOUND> tag, but it is supported by Internet Explorer only.
Animated GIF images
Use Paint, Paint Shop Pro, or some other drawing program to create individual image files that will comprise the animation. Then use a special program such as GIF Animator to specify that these images be displayed sequentially, creating an animation. Add it to your web page by setting up an <IMG> tag where the Src attribute indicates the GIF file you created. You can also use ready-made animated images.
<Marquee> Tag
Text placed between <Marquee> and </Marquee> tags scrolls across the screen. Attributes and their values include: Align="top" or "bottom"; Direction="left" or "right"; Behavior="Scroll" or "Slide" or "Alternate"; Loop="times" – can set "times" equal to infinite; Scrollamount="pixels" – higher the pixel value, the faster the text scrolls; Width="value" – specifies the marquee width; Height="value" – specifies the marquee height; Bgcolor="color" – specifies the marquee background color.
📌 Example - Marquee:
<HTML>
<HEAD>
<TITLE>Marquee</TITLE>
</HEAD>
<BODY>
Discover this amazing compatibility between
<MARQUEE ALIGN="BOTTOM" BGCOLOR="SILVER" WIDTH="200" SCROLLAMOUNT="4">
Islam and Modern Science
</MARQUEE>!
</BODY>
</HTML>
Style sheets
Style sheet instructions can be embedded in the HTML document. One advantage is that the style's formatting definition is created once, and the browser applies that formatting each time the tag is used. Secondly, pages are easier to modify—edit the style definition and all places where the style is used within the page get updated automatically. The most popular type is Cascading Style Sheets (CSS). There are four main methods of using CSS.
Method #1: Embedded method
Give a <style> tag and a </style> end tag in your document. Put the style tags before the <body> tag. Insert all your style definitions between the style tags.
📌 Example:
<HTML>
<head>
<style>
<!--
H1{font-size:72pt}
-->
</style>
</head>
<body><h1>An Example of Embedded Method</h1></body>
</html>
Here, H1{font-size:72pt} is called a style definition, font-size is called a style property, and 72pt is the value of the property. Style definitions are contained within the mark <!-- and -->, which is the HTML comment format. It is better to provide style definitions within the comment tag so that old browsers that do not support the <style> tag do not treat the style definition as text.
💡 Why this matters: The comment tags protect style definitions from being displayed as text in older browsers that don't support CSS.
Method #2: Linking to an external style sheet
A separate file is created with the extension .css, containing your style definitions. Use the <Link> tag inside a web page's <head> section to apply these style definitions.
🔑 Definition — External Style Sheet: A separate .css file containing style definitions that can be linked to multiple HTML pages, allowing uniform styling across an entire website.
📌 Example:
mystyles.css file content:
h1{color:red}
p{font-size:34pt}
HTML file:
<HTML>
<head>
<Link Rel="stylesheet" Type="text/css" href="mystyles.css">
</head>
<body>
<h1>This heading will appear red</h1>
<p>This line has a 34pt font</p>
</body>
</html>
Method #3: Inline styles
Used when a particular tag is to be given a different style. We use style as an attribute in a tag and give properties/values in the format shown below.
📌 Example:
<HTML>
<body>
<h1 style="font-size:40pt">This heading has font-size 40-point</h1>
</body>
</HTML>
⭐ Key Takeaways
The <area> tag supports alt, target, and nohref attributes for controlling image map regions. Sound files can be embedded using the <embed> tag with autostart, loop, and hidden attributes, while <bgsound> is IE-only. Animated GIFs are created by combining sequential images using special software and inserted via the <img> tag. The <marquee> tag scrolls text and can be customized with align, direction, behavior, loop, scrollamount, width, height, and bgcolor attributes. Finally, CSS can be applied through three methods: embedded (within <style> tags in the document head), linked (via an external .css file using <Link>), and inline (using the style attribute directly within HTML tags), with the embedded method using HTML comments to protect style definitions from older browsers.
🧠 Quick Revision Questions
- What are the five attributes supported by the
<area>tag for image maps? - Which sound file formats were mentioned in this lecture?
- What is the purpose of commenting out style definitions with
<!--and-->? - Name the three different methods of using Cascading Style Sheets discussed in this lecture.
- How does the
scrollamountattribute affect the behavior of a<marquee>element?
📘 Lecture 10 — Style Sheets
📖 Overview: This lecture explores Cascading Style Sheets (CSS) in web development, explaining how to apply formatting to HTML elements. It covers various methods of implementing styles, from inline to class-based, and demonstrates how to control fonts, text alignment, colors, and backgrounds for creating visually appealing web pages.
🗂️ Topics Covered
This lecture covers multiple methods of applying style sheets in HTML, including inline styles, styles applied to sections using DIV tags, styles applied to words or phrases using SPAN tags, and style classes. It then demonstrates font control through font-size, font-family, font-weight, and text properties like text-indent, text-align, text-decoration, and text-transform. Finally, it covers color styles for backgrounds and text using CSS properties.
📝 Lecture Summary
Applying a style to a section
The <DIV> tag is used to divide a page into separate sections. The browser inserts a line break before the <DIV> tag and after the </DIV> end tag. By including the "style" attribute inside the <DIV> tag, one can apply an inline style to everything inside <DIV> and </DIV> tags.
💡 Why this matters: The DIV tag allows grouping multiple HTML elements and applying the same style to all of them at once, saving code and ensuring consistency.
📌 Example: <DIV style="font-size:30pt"> <h1>This heading uses a 30-point font</h1> This sentence will have 30-point font <h2>This heading, too</h2> </DIV> — This applies a 30-point font size to all content within the DIV tags.
Applying a style to a word or phrase
Use <SPAN> and </SPAN> and insert the style attribute inside the <SPAN> tag. The <SPAN> tag does not provide any line break, making it useful for styling specific words or phrases within a line without disrupting the flow.
📌 Example: <h1> This <Span style="font-size:40pt">heading </Span> has font-size 40-point </h1> — Only the word "heading" appears in 40-point font while the rest of the line remains unchanged.
Method # 4: style classes
Style classes are used when you want to apply a specific style to a number of different tags and sections throughout the document. Set up a style class within the <style> tag or within an external style sheet file, e.g., .Classname {style definitions go here}. Add a "class" attribute to the tags you want the styles applied to and put it equal to classname (without the dot).
📌 Example:
<STYLE>
.Text1{font-size: 20pt;color:red;text-align:center}
.Text2{font-size: 16pt;color:green;text-align:center}
</STYLE>
<DIV CLASS="Text1"><h1>This text is in red</h1></DIV>
<DIV CLASS="Text2"><h2>This text is in green</h2></DIV>
Using styles to control fonts
Font sizes can be specified using keyword values including: xx-small, x-small, small, medium, large, x-large, xx-large, smaller, and larger. Font sizes can also be specified in points (e.g., 24pt).
📌 Example:
<SPAN STYLE="font-size: xx-small">Physics</SPAN>,
<SPAN STYLE="font-size: x-small">Math</SPAN>,
<SPAN STYLE="font-size: small">Computer Science</SPAN>,
<SPAN STYLE="font-size: medium">Literature</SPAN>,
<SPAN STYLE="font-size: large">E-commerce</SPAN>,
<SPAN STYLE="font-size: x-large">History</SPAN>,
<SPAN STYLE="font-size: xx-large">Islam</SPAN>
Font family styles
The font-family property specifies the typeface to be used. Multiple font names can be listed as a fallback system, with the browser using the first available font. Common font families include "Times New Roman", Arial, "Courier New", and Tahoma.
📌 Example:
<STYLE>
.fonttype1 {font-size: 20pt; font-family: "Times New Roman"}
.fonttype2 {font-size: 20pt; font-family: Arial}
.fonttype3 {font-size: 18pt; font-family: "Courier New"}
</STYLE>
Font weight styles
The font-weight property controls the thickness of text. Predefined weight values are: normal, bold, bolder, lighter. Specific weight values are in the range 100 – 900, where 400 is typically normal and 700 is typically bold.
📌 Example:
<SPAN STYLE="font-weight: 100">Physics</SPAN>,
<SPAN STYLE="font-weight: 400">Fiction</SPAN>,
<SPAN STYLE="font-weight: 700">Computer Science</SPAN>,
<SPAN STYLE="font-weight: 800;font-style:italic;color:red">Sociology</SPAN>
Indenting the first line of a paragraph
Use the text-indent property with a value specified in inches or centimeters (e.g., 0.5in) to indent the first line of a paragraph. This is typically applied using a style rule for the <P> tag.
📌 Example:
P {text-indent: 0.5in}
Aligning the text
Use the text-align property with values: left, right, center, or justify. This property controls the horizontal alignment of text within its container.
📌 Example:
<TD WIDTH="25%" STYLE="text-align: left">...text...</TD>
<TD WIDTH="25%" STYLE="text-align: center">...text...</TD>
<TD WIDTH="25%" STYLE="text-align: right">...text...</TD>
<TD WIDTH="25%" STYLE="text-align: justify">...text...</TD>
Text decoration styles
Use the text-decoration property with values: none, line-through, overline, or underline. These add visual effects to text such as strikethrough, a line above, or underlining.
📌 Example:
<H2 STYLE="text-decoration: none">Introduction to E-commerce</H2>
<H2 STYLE="text-decoration: line-through">Introduction to E-commerce</H2>
<H2 STYLE="text-decoration: overline">Introduction to E-commerce</H2>
<H2 STYLE="text-decoration: underline">Introduction to E-commerce</H2>
Working with the upper case and lowercase letters
The text-transform property has four values: capitalize, lowercase, none, and uppercase. "capitalize" capitalizes the first letter of each word, "lowercase" makes all letters lowercase, "uppercase" makes all letters uppercase, and "none" leaves the text as originally typed.
📌 Example:
<H2 STYLE="text-transform: capitalize"> We love Pakistan</H2>
<H2 STYLE="text-transform: lowercase"> We love Pakistan</H2>
<H2 STYLE="text-transform: none"> We love Pakistan</H2>
<H2 STYLE="text-transform: uppercase"> We love Pakistan</H2>
Coloring the web page with color styles
Using Cascading Style Sheets, one can apply a background color or background image to sections of one's page or even to individual words.
🔑 Definition — background-color: Specifies the background color of an element, using a color name (e.g., blue) or hex code (e.g., #0000FF).
🔑 Definition — background-image: Specifies an image to be used as the background of an element using the syntax URL(filename).
📌 Example:
<DIV STYLE="background-color: yellow; color: blue">...text...</DIV>
<DIV STYLE="background-color: green; color: white">...text...</DIV>
<SPAN STYLE="background-color: red">highlight individual words</SPAN>
<DIV STYLE="background-image: URL(image2.gif); font-size: 16pt;color:white">...text...</DIV>
⭐ Key Takeaways
Students must understand the four methods of applying styles: inline styles directly in tags, DIV tags for styling entire sections, SPAN tags for styling words or phrases without line breaks, and style classes for reusable styles across the document. Font control requires knowledge of font-size (with keywords like xx-small and values in pt), font-family for typefaces, and font-weight ranging from 100-900. Text formatting properties including text-indent, text-align (left, center, right, justify), text-decoration (none, line-through, overline, underline), and text-transform (capitalize, lowercase, uppercase) are each used with specific syntax. Background styling uses background-color with color names or hex codes and background-image with URL(). The key distinction between DIV (block-level with line breaks) and SPAN (inline without line breaks) is essential for proper layout control.
🧠 Quick Revision Questions
- What is the difference between using
<DIV>and<SPAN>tags when applying styles? - How do you create and apply a style class named "Text1" that makes text 20pt, red, and centered?
- What are the predefined keyword values for font-size, and which keyword represents the smallest size?
- What are the four possible values for the text-decoration property and what visual effect does each create?
- How do you apply a background image to a section of a web page using CSS, and what is the correct syntax?
📘 Lecture 11 — Style Sheets
📖 Overview: This lecture explores advanced CSS concepts for web design, focusing on the style sheet box model that governs how block elements are rendered on a page. It covers attachment of background images, dimensioning, padding, borders, margins, and position styles, providing the foundational tools for precise layout control in e-commerce websites.
🗂️ Topics Covered
The lecture covers the attachment of background images using the background-attachment property, then introduces the style sheet box model for block elements. It details dimension properties, padding (with individual and shorthand properties), border properties (including width, style, and color), margins, and finally position styles (absolute, relative, and static) with comprehensive examples and visual results.
📝 Lecture Summary
Attachment of the background image
Using background-attachment: fixed, the background image would remain in place when the user scrolls up and down the page. This creates a parallax-like effect where content moves over a stationary background.
Style sheet box model
Each block element (<P>, <h1>...) is considered to have an invisible box around it. Stuff inside <P>, <h1> to <h6>, <DIV> and <Table> tags etc. is present in the form of blocks. Using the style sheet box model, we can make use of certain properties (dimensions, padding, border, margin and position) to introduce useful styles.
Dimension - Example
The example demonstrates setting height and width properties directly on paragraph elements using inline styles, with a thin solid border applied via a style sheet rule.
📐 Formula: height: value → Sets the vertical dimension of the box
📐 Formula: width: value → Sets the horizontal dimension of the box
📌 Example: <P STYLE="height: 100px">This paragraph is contained in a box 100 pixels high. and <P STYLE="width: 100px">This paragraph is contained in a box 100 pixels wide.
Padding
Padding is the space between the content and its border.
padding-top– adds space on top of the contentpadding-right– adds space to the right of the contentpadding-bottom– adds space below the contentpadding-left– adds space to the left of the contentpadding– general property that applies to all four padding properties in this order: 'padding top, padding-right, padding-bottom, padding-left'
📐 Formula: padding: top right bottom left → Shorthand for all four padding values
📌 Example: <DIV STYLE="padding: 10px 15px 10px 15px"> applies 10px top, 15px right, 10px bottom, 15px left padding
Border
The border property group controls the appearance of the box outline, with three sub-properties: width, style, and color.
Border Width
border-top-width: specifies width of the top borderborder-right-width: specifies width of the right borderborder-bottom-width: specifies width of the bottom borderborder-left-width: specifies width of the left borderborder-width: specifies the width of all borders in the order 'border-top-width, border-right-width, border-bottom-width, border-left-width'
Border style
border-top-style: specifies style of the top borderborder-right-style: specifies style of the right borderborder-bottom-style: specifies style of the bottom borderborder-left-style: specifies style of the left borderborder-style: specifies the style of all borders in the order 'border-top-style, border-right-style, border-bottom-style, border-left-style'- Values for border styles are double, inset, outset, groove, solid, ridge.
Border color
border-top-color: specifies color of the top borderborder-right-color: specifies color of the right borderborder-bottom-color: specifies color of the bottom borderborder-left-color: specifies color of the left borderborder-color: specifies the color of all borders in the order 'border-top-color, border-right-color, border-bottom-color, border-left-color'
📐 Formula: border-width: 1cm; border-style: inset → Creates a 1cm thick inset border
📐 Formula: border-width: 10px; border-color: red green yellow blue; border-style: ridge → Creates a 10px ridge border with different colors on each side
📌 Example: <DIV STYLE="border-width: 1cm; border-style: inset"> This line is written in a box having inset style border and a border width of 1 centimeter.
💡 Why this matters: The border properties allow you to create visually distinct boxes for products, navigation, and content sections in e-commerce interfaces, with the ability to customize each side independently.
Margins
Margins are the space outside the border of an element.
margin-top: specifies the size of the top marginmargin-right: specifies the size of the right marginmargin-bottom: specifies the size of the bottom marginmargin-left: specifies the size of the left marginmargin: specifies the size of all the margins in the order: margin-top, margin-right, margin-bottom, margin-left
📐 Formula: margin: top right bottom left → Shorthand for all four margin values
📌 Example: P {margin-top:100px; margin-bottom:100px; margin-left:200px; margin-right:200px} creates 100px top/bottom margins and 200px left/right margins for all paragraphs
Position styles
The position property allows you to control exactly where an element appears on the page.
position: absolute– you can place the element box anywhere on the pageposition: relative– position is relative to the normal position of the elementposition: static– position remains unchanged
Positioning coordinates:
top– element's position is fixed from the top of browser window (in case ofposition: absolute) or below the element's natural position (in case ofposition: relative)right– element's position from the right side of browser's windowbottom– element's position from the bottom of browser's windowleft– from the left side of the window (in case ofposition: absolute) or to the left of the element's natural position (in case ofposition: relative)
📐 Formula: position: absolute; left: 700px; top: 200px → Places the element exactly 700px from the left and 200px from the top of the browser window
📌 Example: <DIV STYLE="position: absolute; left: 700px; top: 200px">Books Section</DIV> positions the "Books Section" text at a specific location on the page, independent of normal document flow
💡 Why this matters: Absolute positioning is crucial for creating fixed navigation bars, floating shopping carts, and overlay elements in e-commerce websites.
⭐ Key Takeaways
The style sheet box model treats every block element as having an invisible box with content, padding, border, and margin layers that can be independently controlled. Padding adds space inside the border around content, while margins add space outside the border between elements. Border properties allow control over width, style (solid, ridge, inset, etc.), and color, with each side customizable. The position property with absolute, relative, and static values enables precise layout control, where absolute positioning removes an element from normal flow and places it at exact coordinates. Understanding the box model is fundamental to creating properly spaced, visually appealing web layouts for e-commerce interfaces.
🧠 Quick Revision Questions
- What is the difference between padding and margin in the CSS box model?
- In what order do the shorthand
paddingandmarginproperties apply their values? - What are the five possible values for the
border-styleproperty mentioned in the lecture? - How does
position: absolutediffer fromposition: relativein terms of element placement? - What effect does
background-attachment: fixedhave on a background image when a user scrolls?
📘 Lecture 12 — Some Useful Style Sheets Properties
📖 Overview: This lecture introduces positioning properties in CSS, including absolute, relative, and static positioning, along with z-index for three-dimensional layering. It also provides an introduction to JavaScript, covering variables, data types, event handlers, and object manipulation for creating dynamic and interactive web pages.
🗂️ Topics Covered
The lecture begins with practical examples of CSS positioning using absolute, relative, and static values, then moves to three-dimensional positioning with the z-index property. The second half introduces JavaScript fundamentals: variables, data types, event handlers, and how to change images dynamically using mouse events, concluding with a brief note on objects.
📝 Lecture Summary
Example position style
The lecture demonstrates CSS positioning using the position property. With position: absolute, elements are placed precisely using left and top coordinates relative to their nearest positioned ancestor. With position: static (the default), elements flow normally in the document, and left/top values are ignored. With position: relative, the element is shifted from its normal position.
🔑 Definition — position: absolute: Positions an element precisely at specified coordinates relative to the nearest positioned ancestor (or the initial containing block if none). It removes the element from the normal document flow.
📐 Formula: position: absolute; left: Xpx; top: Ypx → Places the element at X pixels from the left edge and Y pixels from the top edge of the containing block.
📌 Example: In the code, <DIV STYLE="position: absolute; left: 700px; top: 200px">Books Section</DIV> places the text "Books Section" 700 pixels from the left and 200 pixels from the top. In the second example, <p STYLE="position: relative; left: 200px; top:5px"> shifts the paragraph 200px right and 5px down from its normal position.
Positioning in the 3rd dimension
The CSS property z-index controls how elements overlap in the third dimension (depth). Elements with a higher z-index value appear on top of those with lower values. This is useful for layering text over images or creating overlapping visual effects.
🔑 Definition — z-index: A CSS property that specifies the stack order of positioned elements. Elements with a higher z-index value appear in front of elements with lower values. Only works on positioned elements (absolute, relative, fixed, or sticky).
📌 Example: The code shows an image (image2.gif) with z-index: 0 and a <DIV> element with z-index: 1 positioned at left: 10px; top: 60px. Because the div has a higher z-index (1), the text "This text appears on top of the image." displays over the image. 💡 Why this matters: z-index allows you to control visual layering, essential for creating complex layouts like dropdown menus, modals, and overlays.
Introduction to JavaScript
JavaScript is a scripting language used primarily for client-side web development to create dynamic, interactive web pages. It is distinct from Java despite the similar name.
🔑 Definition — Variable: A named storage location in computer memory that holds a value that can be accessed and changed. For example, Var i=3; creates a variable named i storing the value 3 at a specific memory address.
Rules for variables: Variable names can begin with a letter (A-Z, a-z), underscore (_), or dollar sign ($). Subsequent characters can include digits (0-9). JavaScript is case-sensitive, meaning money, Money, and mONEY are different variables. Variables do not require explicit data type declaration in JavaScript.
General data types
JavaScript has several data types, but the lecture notes that "you don't need to define the variable with the data type." The general data types discussed include:
- Integer: Whole numbers like 78, 98
- Float: Decimal fractions like 8.9, 6.6
- Char: Single characters like 'A', '5'
- String: Sequences of characters like "hello"
- Boolean: True or false values
The lecture notes that JavaScript's specific data types are: Number, Boolean, String, Null, and Undefined. 💡 Why this matters: Understanding data types helps you know how to use variables correctly and what operations are valid.
Event handler
Event handlers are JavaScript keywords that respond to user actions (events) on an HTML page. Events occur when a user clicks, moves the mouse, submits a form, etc. Common event handlers include:
onclick: When an element is clickedonmouseover: When mouse moves over an elementonmouseout: When mouse moves away from an elementonload: When page finishes loadingonsubmit: When a form is submittedonfocus: When an element gains focusonblur: When an element loses focusonchange: When a form element changes
Changing images using event handlers
JavaScript can dynamically change images using event handlers like onmouseover and onmouseout. The lecture provides two examples:
Example 1 (without hyperlink):
<IMG SRC=contents.gif WIDTH=170 HEIGHT=50 BORDER=0 NAME=picture
onmouseover="picture.src='search.gif';picture.width=250; picture.height=100"
onmouseout="picture.src='contents.gif';picture.width=170; picture.height=50">
When the mouse moves over the image, it changes to 'search.gif' and resizes to 250x100 pixels. When the mouse leaves, it reverts to 'contents.gif' at 170x50 pixels.
Example 2 (with hyperlink):
<A href=image2.gif onmouseover="picture.src='search.gif';picture.width=250; picture.height=100"
onmouseout="picture.src='contents.gif';picture.width=170; picture.height=50">
<IMG SRC=contents.gif WIDTH=170 HEIGHT=50 BORDER=0 NAME=picture></A>
By wrapping the image in an <A> tag, the changed image (search.gif) becomes clickable and opens 'image2.gif' when clicked.
Objects
In programming, an object is a collection of properties (attributes) and functions (methods) that belong together. JavaScript provides predefined objects that are ready to use, but custom objects can also be created in object-oriented languages.
🔑 Definition — Object: A programming construct that bundles together properties (data) and methods (functions) that operate on that data. In JavaScript, objects can be built-in (like document, window) or user-defined.
⭐ Key Takeaways
CSS positioning (absolute, relative, static) controls element placement on the page, with absolute removing elements from normal flow and relative shifting them. The z-index property manages which elements appear on top when they overlap. JavaScript variables are case-sensitive and don't require type declaration, with data types including Number, Boolean, String, Null, and Undefined. Event handlers like onmouseover and onmouseout enable dynamic image swapping and interactive effects without page reload. Understanding these concepts is crucial for creating visually layered, interactive web pages that respond to user actions.
🧠 Quick Revision Questions
- What is the difference between
position: absoluteandposition: relativein CSS? - How does the
z-indexproperty affect overlapping elements, and what must be true for it to work? - What are the rules for naming variables in JavaScript, and why is case-sensitive important?
- Name four common event handlers and describe the user action that triggers each one.
- In the image-swapping example, what happens when the mouse moves over the image, and how does wrapping it in an
<A>tag change the behavior?
📘 Lecture 13 — Java Scripting
📖 Overview: This lecture introduces JavaScript as a scripting language embedded in HTML to create interactive web pages. It covers basic JavaScript syntax, embedding scripts in HTML, browser objects, operators, functions, and practical examples including alert boxes, writing to pages, and building a simple calculator.
🗂️ Topics Covered
The lecture covers embedding JavaScript in HTML using script tags, the alert() function for popup messages, the document.write() method for writing content to web pages, browser objects (window and document), JavaScript operators (mathematical, logical, comparison), defining variables and functions, and creating an interactive calculator with event handlers that performs addition and subtraction displaying results either in alert boxes or text boxes.
📝 Lecture Summary
Java script examples
JavaScript instructions are embedded in HTML code using <SCRIPT> and </SCRIPT> tags with the attribute LANGUAGE="JavaScript" TYPE="text/javascript". The lecture demonstrates a simple example where an alert box appears when the page loads.
🔑 Definition — alert(): A function/method of the predefined browser window object used to create popup messages on the window.
📌 Example:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
alert("Thank you for visiting my web site!")
//-->
</SCRIPT>
When the page loads, a popup appears displaying "Thank you for visiting my web site!" as shown in Fig. 1. The // is used for comments, and old browsers that don't support JavaScript treat the script content as comments.
Writing on the page
The document.write() method is used to write text directly onto the web page. The document is a browser object, and write is its function.
🔑 Definition — document.write(): A method of the browser document object used to write text or HTML content onto the web page.
📌 Example:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
document.write("Hello! Thank you for visiting my web site.")
//-->
</SCRIPT>
When the page loads, the text "Hello! Thank you for visiting my web site." appears on the page (as shown in Fig. 2). Browser objects are loaded by a JavaScript-capable browser to provide access to the web page and its HTML elements, allowing interaction and updates.
Operators in java script
Three categories of operators are covered:
Mathematical operators:
+— Addition-— Subtraction*— Multiplication/— Division%— Modulus (calculates remainder)++— Increment--— Decrement
Logical operators:
&&— Logical AND||— Logical OR!— Logical NOT
Comparison operators:
==— Equal!=— Not equal<— Less than<=— Less than or equal>— Greater than>=— Greater than or equal
Functions in javascript
Variables in JavaScript are defined using the keyword var, and functions using the keyword function. A function definition follows this format:
function myfunction() {
// some code
}
Here, myfunction is the name of the function.
Creating a calculator in JavaScript
The lecture demonstrates building a simple calculator with two functions: Addit() and minus(). The event handler onclick is used in HTML button elements to trigger the appropriate function when clicked.
🔑 Definition — parseFloat(): A JavaScript function that converts a string into a floating-point number, used for numeric calculations.
📌 Example (alert box version):
function Addit() {
var num1 = document.Calform.One.value;
var num2 = document.Calform.Two.value;
alert(parseFloat(num1) + parseFloat(num2));
}
The HTML form includes two text input fields named "One" and "Two" for entering numbers, and two buttons: "Add Them!!" (calls Addit()) and "Subtract Them!!" (calls minus()). When the user enters 3 in the first box and 9 in the second and clicks "Add Them!!", an alert box displays "12" (Fig. 3). Clicking "Subtract Them!!" displays "-6" (Fig. 4).
📌 Example (text box version):
To display the result in a text box instead of an alert box, the code changes the document.Calform.result.value property directly:
function Addit() {
var num1 = document.Calform.One.value;
var num2 = document.Calform.Two.value;
document.Calform.result.value = parseFloat(num1) + parseFloat(num2);
}
The HTML adds a third text input named "result" with the Disabled attribute so users cannot type in it. When the user enters 125 and 66 and clicks "Add Them!!", the result 191 appears in the result text box (Fig. 5). The // comments out the old alert code.
💡 Why this matters: Understanding how to use event handlers like onclick to trigger JavaScript functions enables creating interactive web forms that respond to user input without page reloads.
⭐ Key Takeaways
You must remember that JavaScript code is embedded in HTML using <SCRIPT> tags and can manipulate web pages through browser objects like window (for alert boxes) and document (for writing content or accessing form elements). The alert() function creates popup messages, while document.write() writes directly to the page. JavaScript has mathematical, logical, and comparison operators, and functions are defined with the function keyword. Event handlers like onclick link HTML elements to JavaScript functions. The parseFloat() function converts string input to numbers for calculations, and form elements are accessed using the dot notation structure document.FormName.ElementName.value.
🧠 Quick Revision Questions
- What are the two browser objects demonstrated in this lecture, and what functions are associated with each?
- How do you embed JavaScript code within an HTML page, and why is
//used in the script tag? - Write the JavaScript code to access the value entered in a text input named "age" within a form named "myForm".
- What is the purpose of the
parseFloat()function, and why is it necessary when performing calculations with form input values? - How does the
onclickevent handler work to trigger JavaScript functions when a button is clicked?
📘 Lecture 14 — JAVA SCRIPTING (CONTINUED....)
📖 Overview: This lecture continues the study of JavaScript by demonstrating how to display arithmetic results on a web page using
document.write()andalert()functions. It also introduces conditional execution withifstatements, looping withforloops, and several predefined JavaScript objects like Global, Array, and Math, along with practical examples including a drop-down list of links.
🗂️ Topics Covered
The lecture covers displaying addition and subtraction results using document.write(), creating a multiply and divide calculator using alert(), building a drop-down list of links with the onchange event handler, using if statements for conditional subtraction, implementing for loops to generate dynamic HTML headings, and exploring predefined JavaScript objects such as Global, Array, and Math with code examples.
📝 Lecture Summary
Displaying Results with document.write()
We can get the result of addition or subtraction written on a page using the write function of the document object. The code uses document.write() to concatenate text strings (in double quotes) with arithmetic results using the + sign. The parseFloat() function (a method of the predefined Global object) converts text input to floating-point numbers for calculation.
🔑 Definition — parseFloat(): A function that parses a string argument and returns a floating-point number.
📐 Formula: document.write("text" + (parseFloat(num1) + parseFloat(num2))) → Writes text followed by the arithmetic result on the web page.
📌 Example: When a user types 3 and 9 in the text boxes and clicks "Add Them!!", the result 12 is written on the page. Clicking "Subtract Them!!" writes -6.
Multiply and Divide Calculator
This example uses the alert() function to display results in a pop-up dialog box instead of writing on the page. The code defines two functions: Multiplyit() and Divideit(), each using parseFloat() to convert input values and then applying multiplication (*) or division (/) operators.
🔑 Definition — alert(): A JavaScript function that displays a dialog box with a specified message and an OK button.
📐 Formula: alert(parseFloat(num1) * parseFloat(num2)) → Shows the multiplication result in a pop-up.
📌 Example: Entering 24 and 4, then clicking "Multiply" shows 96 in an alert box; clicking "Divide" shows 6.
💡 Why this matters: alert() is useful for immediate feedback without modifying the page content, while document.write() overwrites the entire page content.
Example - A Drop-Down List of Links
This example creates a navigation menu using a drop-down list (select element) with the onchange event handler. When a user selects an option, the GoToIt(list) function executes. The keyword this passes the select element's information to the function's argument list. The selected option's value is assigned to variable selection, and the location.href = selection changes the browser's current page to the selected URL. Location is another predefined browser object.
🔑 Definition — onchange: An event handler that triggers when the value of an element changes (e.g., when a user selects a different option from a drop-down list).
🔑 Definition — this: A keyword that refers to the current HTML element (in this case, the select element).
📐 Example: Selecting "Calculator" from the list navigates to "calculator.htm". The default option "Select a page previously done --->" has value "None", which is ignored by the if condition.
Example - If Statement
The IF statement is used to alter the course of code execution depending on a condition. The code checks if the first number is less than the second number. If true, it displays "negative" using alert(); otherwise, it displays the subtraction result.
🔑 Definition — IF statement: A conditional statement that executes code blocks based on whether a condition evaluates to true or false.
📐 Syntax: if(condition) { statements } else { statements }
📌 Example: With first number 3 and second number 9, the condition parseFloat(3)<parseFloat(9) is true, so "negative" is displayed. With first number 9 and second number 3, the condition is false, so the subtraction result 6 is displayed.
For LOOP
When we want some action to take place repeatedly until a particular condition is met, we can apply a for loop. The general format is: for(initializationStatement; condition; updateStatement) { statements }. The code executes repeatedly while the condition remains true.
🔑 Definition — for loop: A control flow statement that allows code to be executed repeatedly based on a given boolean condition.
📐 Formula: for(i=1; i<7; i++) → Initializes i to 1, runs while i is less than 7, and increments i by 1 after each iteration.
📌 Example: The code for(i=1;i<7;i++) document.write("<H"+i+">Hello "+i+"!!</H"+i+">"); generates six different heading levels (H1 through H6), each displaying "Hello [number]!!".
Some predefined JavaScript objects
A list of some commonly used predefined JavaScript objects includes Global, Array, String, Math, and Date.
The Global object has globally-accessible variables/properties and functions. Netscape Navigator and Internet Explorer implement it but don't allow explicit creation. Its properties and methods are referenced directly. NaN (Not a Number) is one of its properties. parseFloat(string) is a method of the Global Object. Properties do not have parentheses following their names, while functions do. Arguments are the information contained in the parentheses of a function.
The Array object has properties and functions. Length is an important property that identifies the array's size. Its methods include toString(), reverse(), sort(), and join().
🔑 Definition — Array: An object that stores multiple values in a single variable, with each value accessible by an index number.
📌 Example: myArray=[0,1,2,3,4,5,6,7,8,9,10]; creates an array. myArray[0] returns 0. myArray.toString() returns "0,1,2,3,4,5,6,7,8,9,10". myArray.join(':') returns "0:1:2:3:4:5:6:7:8:9:10". myArray.reverse() returns "10,9,8,7,6,5,4,3,2,1,0". myArray.sort() returns "0,1,10,2,3,4,5,6,7,8,9" (lexicographic sort).
The Math object provides a standard library of mathematical constants and functions.
🔑 Definition — Math object: A predefined JavaScript object with mathematical constants and methods.
📌 Example: Math.PI returns 3.141592653589793. Math.LN2 returns 0.6931471805599453. Math.sin(90) returns 0.8939966636005579. Math.random() returns a random number between 0 and 1 (e.g., 0.3228030884336356). Math.pow(2,3) returns 8. Math.min(123,133) returns 123.
⭐ Key Takeaways
You must remember how to use document.write() and alert() for displaying output, and understand the difference between them — document.write() overwrites the page while alert() creates a pop-up dialog. The if statement is essential for conditional logic, and the for loop is crucial for repetitive tasks. Predefined JavaScript objects like Global, Array, and Math provide built-in functions and properties that simplify coding — particularly parseFloat() for number conversion, array methods like toString(), reverse(), and sort(), and Math methods like random(), pow(), and min(). Finally, event handlers like onchange and the this keyword are important for creating interactive web elements like navigation menus.
🧠 Quick Revision Questions
- What is the difference between
document.write()andalert()when displaying results in JavaScript? - In the drop-down links example, what does the keyword
thisrefer to and how is it passed to the GoToIt() function? - Write the general syntax of a
forloop and explain its three components. - What does
parseFloat()do and which JavaScript object does it belong to? - How does the
sort()method work on an array of numbers, and what does the output ofmyArray.sort()look like for the array [0,1,2,3,4,5,6,7,8,9,10]?
📘 Lecture 15 — JAVA SCRIPTING (CONTINUED....)
📖 Overview: This lecture continues the exploration of JavaScript by demonstrating how to work with the Date object to display current date and time, and the String object with its various methods. It then applies JavaScript for client-side form validation, showing how to check user input for required fields, length constraints, pattern checks, and password confirmation before form submission, which improves data quality and user experience.
🗂️ Topics Covered
The lecture covers the Date object with examples showing how to display current date/time using the constructor Date() and how to create an instance to get user-friendly formatted dates using methods like getDay(), getMonth(), getYear(), getHours(), and getMinutes(). It then introduces the String object with examples of methods charAt(), substring(), toLowerCase(), toUpperCase(), and split(). Finally, it demonstrates using JavaScript for client-side form validation with a registration form example that checks empty fields, length constraints, special characters, and password matching.
📝 Lecture Summary
Example - Date object
This section shows a simple example using the Date() constructor directly within document.write() to display the current system date and time. The code <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> document.write(“Welcome! you are visiting my web site on " + Date()) </SCRIPT> produces output like "Welcome! you are visiting my web site on Mon Apr 10 2025...". Here, Date() is the constructor of the date object which provides the current date of the system.
🔑 Definition — Constructor: The initializing function used to create an instance/copy of an object. It is named after the object whose constructor it is.
📐 Formula: new Date() → Creates a new instance (copy) of the Date object containing the current date and time.
📌 Example: d = new Date() creates an instance d of the Date object, then methods like d.getDay() (returns 0-6 for Sunday-Saturday), d.getMonth() (0-11), d.getYear(), d.getHours(), and d.getMinutes() can be called.
Getting date and time in a user friendly format
To get the date/time in a different format, an instance of the date object is created. In the example, d is such an instance created using new Date(). The code then uses if statements to convert numeric day values (0-6) to day names (Sunday-Saturday), numeric month values (0-11) to month names (January-December), and handles year formatting with conditional logic for years before vs. after 2000. For time, it gets hours and minutes, formats minutes with leading zero if less than 10, and customizes greeting messages ("Good morning!", "Good afternoon!", "Good evening!") based on the hour value using multiple if-else if-else statements. The result displays a complete sentence like "Good afternoon! It's Saturday, April 10, 2025 at 2:30 PM".
💡 Why this matters: This demonstrates how to convert raw numeric date/time values from the Date object into a human-readable, user-friendly string with customized greetings, which is commonly used on websites for personalized welcome messages.
Example - String object
This example creates str as an instance of the String object using new String("This is a test of javascript string methods") and myArray as an instance of the Array object with size 10 (though size is dynamically adjusted by split()). The charAt() method of the string object returns the character at a specified index — charAt(3) returns the character at index 3 (0-based indexing). Other methods demonstrated include: substring(20,25) extracts characters from index 20 to 25 (not including 25), toLowerCase() converts entire string to lowercase, toUpperCase() converts to uppercase, and split(' ') splits the string on blank spaces into an array, assigning each part as an array element (e.g., myArray[0] becomes "This", myArray[1] becomes "is").
🔑 Definition — charAt(index): A method of the String object that returns the character at the specified index (0-based) within the string.
📐 Formula: string.split(separator) → Splits a string into an array of substrings using the specified separator character.
📌 Example: str="This is a test"; myArray=str.split(' '); results in myArray[0]="This", myArray[1]="is", myArray[2]="a", myArray[3]="test".
Using java script for applying for checks in a registration form
JavaScript can be used for applying different checks on a web form including pattern checking. The example defines a function checkValues() that is called when the form is submitted (via onSubmit="return checkValues()"). The function retrieves form field values using document.regForm.fieldName.value. It performs several validations: first checks if Userlogin, userAddress, or Name fields are empty (length == 0) and displays an alert "Please fill in all values". Then it checks if Userlogin length is within 3-15 characters (using variables minLength=3 and maxLength=15) and displays an alert if violated. Similarly, it checks UserPassword length within 3-15 characters. It also checks for invalid characters in Userlogin using a loop checking each character for commas or semicolons using charAt(i). Finally, it checks if UserPassword matches conPassword (confirm password) and displays "Passwords do not match" if different. If any check fails, the function returns false, preventing form submission to the server side (regcheck.asp). Only if all checks pass does it return true, allowing data to be sent to the server.
💡 Why this matters: Client-side validation using JavaScript improves user experience by providing immediate feedback without server round-trips, reduces server load, and helps ensure data quality before submission. However, server-side validation should always complement client-side validation for security.
⭐ Key Takeaways
The Date object provides both a simple constructor Date() and a more flexible instance-based approach using new Date() to access individual components like day, month, year, hours, and minutes through methods such as getDay(), getMonth(), getYear(), getHours(), and getMinutes(). The String object offers powerful methods like charAt(), substring(), toLowerCase(), toUpperCase(), and split() for string manipulation and parsing. JavaScript form validation is implemented by defining a function that checks form field values before submission, using the onSubmit event handler to call this function, and returning false to prevent submission when validation fails. Common validation checks include empty fields, length constraints, pattern/character checks, and password confirmation. Remember that client-side validation enhances user experience but is not a substitute for server-side validation, as JavaScript can be disabled or bypassed.
🧠 Quick Revision Questions
- What is the difference between using
Date()directly and creating an instance withnew Date()? - What values does
d.getDay()return (range and meaning), and how would you convert it to a day name? - What does the
split(' ')method do to a string, and how are the resulting parts accessed? - In the form validation example, what three empty-field checks are performed first, and what happens if any is empty?
- How does the
onSubmit="return checkValues()"attribute in the form tag control whether data is sent to the server?
📘 Lecture 16 — JAVA SCRIPTING AND XML
📖 Overview: This lecture covers two main areas: first, using JavaScript's
forloop to validate user inputs in web forms, including checking for invalid characters and password matching; second, introducing XML (Extensible Markup Language) as a powerful alternative to HTML for data management, including its syntax rules, embedding in HTML, and styling with XSL. Understanding these topics is crucial for creating robust, data-driven web applications.
🗂️ Topics Covered
The lecture begins by demonstrating how JavaScript's for loop can be employed in a registration form to check for invalid characters like commas in a user login field and to verify that two entered passwords match. It then introduces XML, explaining its creation by the W3C, its advantages over HTML for data management, and its fundamental differences: user-defined tags and semantic meaning. The lecture details XML syntax rules, methods for embedding XML in HTML documents, and the use of XSL (Extensible Stylesheet Language) for formatting XML data, concluding with a comparison of HTML and XML editors.
📝 Lecture Summary
JAVA SCRIPTING AND XML
For loop can be used in the code of Registration form to check that users do not type invalid characters in the text box. For example, in case a user types a “,” in the text box for user login, an alert box can be made to display informing him that it is an invalid user login. See Fig. 1 below.
🔑 Definition — For loop/statement: The initialization statement is executed only at the beginning of the For loop’s execution. The condition is then tested, and if it is true the statements enclosed within the curly brackets are executed. If the condition is false, the loop is terminated and the statement following the For statement is executed.
Another check can also be applied to see that the passwords entered in two different text boxes by the user are the same. In case the two passwords do not match an alert box can inform the user about it (see Fig. 2 below). In case no condition applied in the code is violated then the function checkValues returns true at ‘onsubmit’. Consequently, the information provided by the user in the form is forwarded to the server side.
Extensible markup language
World Wide Web Consortium (W3C), a non-profit organization that maintains standards for the web presented the draft of XML in late 1990’s. It is also used for web page creation and includes data management capabilities that HTML cannot provide. Consider the example of a list of planets. Suppose that same HTML heading tags are decided to be used each planet. Also, suppose that it is decided to display different pieces of information about a planet in different heading sizes. Then, there is a shortcoming in respect of HTML that it can only supply upto 6 different levels of headings. In case there are more than six different pieces of information to display, then HTML loses its efficacy. That is why web professionals have found XML as a list formatting alternative of HTML.
📐 Formula: The key difference between HTML and XML: HTML has predefined tags and formats appearance; XML allows user-defined tags that convey meaning.
XML differs from HTML in two important respects:
- XML is not a markup language with defined tags; rather, one can create one’s own set of tags in XML.
- XML tags do not provide information how text would appear on a web page. Instead of that XML tags convey meaning of information included within them.
First line of the XML code is a declaration that it is an XML document (version 1). The second and last lines of the code are called root element tags. We enclose other elements within the root element tags. Other elements are called child elements. Names of child elements can be different between two organizations, which can make the sharing of information difficult. This has led to the necessity of having uniform standards for writing different types of XML documents. Many companies have agreed to follow common standards for XML tags. A file that uses XML tags is called data type definition (DTD) or XML schema. Different DTDs are available for different industries.
Rules for writing an XML code
- All elements must be properly nested
<outer><inner>content</inner></outer> - All attribute values must be quoted
<FRIES SIZE="LARGE"> - All elements with empty content must be identified by ending in
/><BR/>,<img src="image2.gif" /> - All elements must be cased consistently
<PART>must not be closed as</part> - Certain characters having reserved meanings cannot be used e.g,
&,<etc.
Embedding XML into HTML documents
<XML> element can be used anywhere within HTML document to enclose XML content. Also, <script> element can be used for such purpose e.g, <script language="xml" type="text/xml">......</script>
Extensible Style sheet Language (XSL)
XML files are translated using another file which contains formatting instructions. Formatting instructions are often written in Extensible Style sheet Language (XSL). These formatting instructions are read over by special programs – usually these programs are written in Java programming language - called XML Parsers.
We write XSL rules that match various XML elements. Note that we use <rule> elements and <target-element> in our XSL code to provide formatting instructions for the corresponding XML elements.
HTML and XML editors
General purpose text-editors for HTML are Notepad, Wordpad etc. However, there are certain HTML editors that help create web pages more easily, e.g, Macromedia Dreamweaver and Microsoft FrontPage. XML code can also be written in any general purpose text editor. However, there are special programs such as Epic Editor, TurboXML which can facilitate the editing job considerably.
⭐ Key Takeaways
The for loop in JavaScript is essential for iterating through form inputs to validate data, such as checking for invalid characters like commas and ensuring password fields match. XML was developed by the W3C to overcome HTML's limitations in data management, as it allows users to define their own tags that describe the meaning of data, not its appearance. XML documents must follow strict syntax rules, including proper nesting, quoted attribute values, consistent casing, and the use of root and child elements. To format XML for display, XSL (Extensible Stylesheet Language) is used, where rules with <rule> and <target-element> tags are written to style specific XML elements. While XML can be written in any text editor, specialized tools like Epic Editor and TurboXML significantly ease the process.
🧠 Quick Revision Questions
- How can a JavaScript
forloop be used to validate user input in a registration form? - What are the two key differences between HTML and XML in terms of tags and purpose?
- List five mandatory rules for writing valid XML code.
- How can XML content be embedded directly into an HTML document?
- What is the role of XSL (Extensible Stylesheet Language) and XML Parsers in processing an XML file?
📘 Lecture 17 — Client and Server Side Processing of Data
📖 Overview: This lecture explains the two-way client-server communication model, detailing what processing occurs on each side. It focuses on client-side technologies like JavaScript and applets, with special emphasis on cookies—how they are created, stored, and used for tracking customers and maintaining session state. Understanding this division of labor is critical for designing efficient web applications.
🗂️ Topics Covered
Client-side data processing includes HTML rendering, JavaScript execution, applets, and cookies stored on the user's hard disk. Server-side processing handles database queries and complex logic. The lecture demonstrates cookie creation via JavaScript, explains cookie usage for customer tracking and session state maintenance, and distinguishes between fat clients (heavy client processing) and thin clients (minimal client processing).
📝 Lecture Summary
Client side processing
Data processed on the client side includes HTML code, most JavaScript, applets, and cookies (in most cases). The browser interprets HTML tags and executes JavaScript for simple calculations and pattern checking, as seen in earlier calculator and registration form examples. Applets are compiled Java programs sent from the server to the browser for execution, such as animation files, games, and spreadsheets. An applet is called using the <APPLET> tag with the CODE attribute pointing to the applet's URL, plus WIDTH and HEIGHT attributes for display space.
📌 Example: Applet call code
<HTML> <BODY>
<APPLET CODE=http://www.xyz.com/carfind.class width=100 height=200>DEMO</APPLET>
</BODY> </HTML>
Cookies
Cookies are text files stored on the client's hard disk, sent by the server side due to cookie-related programming. They are usually generated by JavaScript or CGI scripts. In JavaScript, the document.cookie property creates a cookie. When a user clicks a button, a function like updateCookie() creates the cookie, then location.reload(true) refreshes the page to display the new cookie value.
📌 Example: Cookie creation code
<SCRIPT LANGUAGE="JavaScript">
function updateCookie() {
document.cookie = document.form1.cookie.value;
location.reload(true);
}
</SCRIPT>
<FORM NAME="form1">
This information would be treated as a Cookie: <INPUT TYPE="TEXT" NAME="cookie" size="50">
<INPUT TYPE="Button" VALUE="Set Cookie!" onclick="updateCookie()">
</FORM>
When a user types "Ahmad" and clicks "Set Cookie," the cookie 'Ahmad' is created and stored on the hard disk.
🔑 Definition — Cookie: A text file stored on the client's hard disk by the server, used to store small pieces of data like user preferences or unique IDs.
Uses of Cookies
Cookies are used to track customers online. A unique ID is stored in the cookie file on the hard disk, and the same ID is stored in the merchant's database along with the customer's purchase history. When the customer revisits, the browser transmits the cookie to the server, which matches the ID with the database, allowing personalized recommendations in real time.
Cookies also maintain state between broken sessions. Information from a previous session (e.g., form data) can be stored in the cookie and made available to the server in a subsequent session. The expires attribute sets the cookie's expiration date.
📌 Example: Storing multiple variables with expiration
firstName = document.form1.first.value;
lastName = document.form1.last.value;
email = document.form1.email.value;
expirationDate = "Friday, 01-Dec-11 12:00:00 GMT";
document.cookie = "firstname=" + firstname + ";lastname=" + lastname + ";email=" + email + ";expires=" + expirationDate;
💡 Why this matters: Cookies are fundamental for e-commerce personalization, shopping carts, and maintaining user login state across page visits.
Fat vs. Thin Client
Fat clients perform a lot of processing on the client side, while thin clients perform minimal client-side processing, with most work done on the server side.
🔑 Definition — Fat Client: A client machine that handles significant processing, such as running applets or complex JavaScript, reducing server load but requiring more client resources.
🔑 Definition — Thin Client: A client machine that does minimal processing, relying heavily on the server for data handling and logic, typical of simple browsers.
⭐ Key Takeaways
Client-side processing includes HTML, JavaScript, applets, and cookies. Cookies are text files stored on the client's hard disk, created using document.cookie in JavaScript, and used for customer tracking by storing a unique ID matched against a server database. Cookies also maintain state between sessions by storing form data with an expiration date. Applets are called via the <APPLET> tag with CODE, WIDTH, and HEIGHT attributes. The fat vs. thin client distinction depends on how much processing occurs on the client versus the server.
🧠 Quick Revision Questions
- What are the main data types processed on the client side?
- How is a cookie created in JavaScript, and what property of the document object is used?
- Name two practical uses of cookies in e-commerce.
- How does the
<APPLET>tag specify the location of the applet code? - What is the difference between a fat client and a thin client?
📘 Lecture 18 — Applets, CGI Scripts
📖 Overview: This lecture explains how e-commerce websites use server-side processing to create dynamic content by connecting front-end interfaces with back-end databases. It covers key technologies including CGI scripts, SQL queries, servlets, and server-side scripts like ASP, and explains how these tools enable form handling, database queries, and state maintenance for interactive web applications.
🗂️ Topics Covered
The lecture begins with definitions of web servers and databases, then introduces CGI scripts as a method for server-side communication with databases. It covers SQL for querying databases, servlets as fast Java applications on the server, and server-side scripts including ASP, JSP, and PHP. The lecture also discusses ODBC/JDBC drivers, compares different technologies based on compilation vs. interpretation, and provides detailed ASP examples showing form handling and variable usage.
📝 Lecture Summary
CGI Scripts
The Common Gateway Interface (CGI) is defined as a standard method/protocol that allows data from forms to be used by programs on the server. A script is a program running on the server. CGI scripts include programs written in C, C++ or Perl. When a client makes an HTTP request by clicking a hyperlink referencing a CGI script, the server communicates with the CGI script using the CGI protocol, executes it, and the script can generate a query to the database to retrieve specific information. This information is then supplied to the client as an HTML document.
🔑 Definition — Common Gateway Interface (CGI): A standard method/protocol that allows data from forms to be used by programs on the server.
Example: A web page has two links. When the user clicks "List of IT Books for sale", an HTTP request goes to the CGI script hello2.cgi. This script generates a Select * from ITBOOKS query in SQL and retrieves all information from the IT books table as a result for the user.
Structured Query Language (SQL)
SQL stands for Structured Query Language. It is used to make queries from databases. The general syntax uses the select statement to retrieve data from databases. Using * after select and then from tablename picks the entire information from a table. Specific information can be retrieved by specifying conditions.
📐 Formula: Select * from tablename → retrieves all columns and rows from the specified table
📐 Formula: Select column1, column2 from tablename where condition → retrieves specific data based on condition
📌 Example: Select author, publisher from ITBOOKS where coursename='e-commerce' — retrieves only author and publisher columns for books where the course name is 'e-commerce'
The insert statement is used to insert data into a database. For example, when a user fills a web form and clicks the Register! (submit) button, the information is shipped to an ASP file on the server, which executes an insert query to record the data in a table. The delete and update statements are used for deleting and updating data in tables.
Servlets
Servlets are very fast Java applications on the server side which are available in an active form in the memory of the server. They use JDBC to connect to databases.
Server Side Scripts
These include ASP (Active Server Pages) — Microsoft's product, JSP (Java Server Pages) — Sun Microsystems' product, and PHP (Hypertext Preprocessor) — Apache Software Foundation's product. Their code can be embedded within HTML documents and they use extensions (.asp), (.jsp) or (.php). The server sees the extension of the file and processes the relevant embedded code, providing the result to the client side.
ODBC/JDBC
ODBC (Open Database Connectivity) and JDBC (Java Based Database Connectivity) are drivers present on the server side. Scripts or programs use these to establish connection with databases for querying.
Basic Differences Between CGI Scripts, ASPs, Servlets etc.
Code is translated into executable form in two ways: compilation (using a compiler) or interpretation (line by line at runtime using an interpreter). Compiled code is usually faster than interpreted code. ASP, PHP and Coldfusion interpret their code, except ASP.net where code is compiled. In JSP, a program called the JSP engine compiles the code only once, after which the JSP page is converted into a servlet. A servlet is always in an active form in server memory, so subsequent calls have faster response time — this is the main difference between JSP and a servlet. Another difference is that ASP mostly uses VBScript while JSP uses Java. Among CGI scripts, Perl scripts are interpreted and C++ scripts are compiled. However, CGI scripts are generally slow because each CGI request generates a new process which is heavy for the system, making them less popular today.
🔑 Definition — Option Explicit: A directive in VBScript that forces explicit declaration of all variables using the Dim statement to prevent errors from mistyped variable names.
ASP (Active Server Pages)
ASP runs best on IIS (Internet Information Server), freely available with Windows NT and Windows 2000. The ASP engine is a piece of software that is part of IIS and interprets/translates ASP code. There are seven predefined objects called intrinsic objects in ASP. Two important ones are: the Response object (used to send information to the client) and the Request object (used by the server to retrieve information from the client).
ASP statements are contained within delimiters <% and %>. ASP normally uses VBScript as the scripting language. A variable is defined using the Dim statement. To avoid errors from mistyped variable names, Option Explicit must be written at the top of each ASP file.
📐 Formula: Response.Write variable → sends the value of the variable to be displayed on the client's web page
📐 Formula: Request.Form("fieldname") → retrieves data submitted from a form field with the given name
📌 Example 1: The ASP code sets variables lastname=“Ali”, firstname=“Imran”, myage=30, then outputs: "My name is Imran Ali and my age is 30" using Response.Write.
📌 Example 2: A form with two text boxes (userlogin and username) submits to an ASP file. The ASP code uses Request.Form("userlogin") and Request.Form("username") to collect data, then displays: "My name is [username] and I am going to use [userlogin] as my login".
📌 Example 3: VBScript with For loop — sets myString=“ecommerce”, then uses: For j=1 to 3 with Response.Write mystring, printing "ecommerce" three times on the page. Also uses If statement checking time: if time is between 12:00 AM and 12:00 PM, prints "Good Morning Pakistan", otherwise prints "Hello Everyone" followed by the three repetitions of "ecommerce".
💡 Why this matters: Understanding the difference between compiled (faster) and interpreted (slower) server-side technologies helps in choosing the right tool for e-commerce applications that require fast, scalable responses.
⭐ Key Takeaways
CGI scripts use a standard protocol for server-side programs to handle form data and database queries but are slow because each request creates a new process. Servlets are compiled Java applications that remain active in server memory for fast response times, while JSP pages are compiled once into servlets by a JSP engine. ASP uses VBScript with intrinsic objects like Response and Request for sending and receiving data, and requires Option Explicit to prevent variable errors. SQL uses select, insert, delete, and update statements for database operations, with the select statement allowing both general (*) and specific (where clause) data retrieval. Server-side scripts are embedded in HTML with delimiters and processed by the server before sending results to the client.
🧠 Quick Revision Questions
- What is the main difference between CGI scripts and servlets in terms of how they handle multiple requests?
- Write the SQL syntax to retrieve only the "author" and "publisher" columns from a table called "ITBOOKS" for books in the 'e-commerce' course.
- What are the two intrinsic ASP objects mentioned and what is each used for?
- Why must
Option Explicitbe written at the top of ASP files using VBScript? - How does JSP differ from ASP in terms of code execution (interpretation vs. compilation)?
📘 Lecture 19 — MAINTAINING STATE IN A STATELESS SYSTEM
📖 Overview: This lecture explains how to maintain state across different steps of an e-commerce transaction despite HTTP being a stateless protocol. It covers various techniques for linking registration, item selection, and order confirmation steps, along with client-server architecture, web server components, and e-commerce software functions.
🗂️ Topics Covered
The lecture covers methods for maintaining state including server-side temporary files, cookies, hidden form fields, and databases. It then explains client-server architecture from 1-tier to 4-tier systems, followed by web server hardware and software components, operating systems, web server performance metrics, hosting options, and finally e-commerce software features including catalog display, shopping carts, transaction processing, and advanced functions like middleware and web services.
📝 Lecture Summary
MAINTAINING STATE IN A STATELESS SYSTEM
HTTP is stateless, meaning each request is independent. To maintain state across different steps of an e-commerce transaction (Registration → Add to Cart → Confirm Order), programmers must link these steps. Several methods are available.
A temporary file can be created on the server side. Scripts behind each step store information in this temporary file using the same common ID. At the end, the confirm order script inserts this information into a database using an insert query.
Cookies on the client side can store information about Registration and Add to Cart steps. When Confirm Order is clicked, cookies revert to the server side and information is stored in databases against a common ID.
Hidden form fields keep data moving back and forth within forms. The code below shows a form with hidden input fields paired with checkboxes. When users select items and click Add to Cart, selected information goes to a script that opens a new page with a Confirm Order button. The item codes remain hidden in this new form. When Confirm Order is pressed, selected items are stored in the database using the hidden item codes.
📌 Example — Hidden Fields:
<FORM NAME="Form1">
<INPUT TYPE="HIDDEN" NAME="Shirt1" VALUE="25">
<INPUT TYPE="CHECKBOX" NAME="Check1">Blue Cotton Shirt<br>
<INPUT TYPE="HIDDEN" NAME="Shirt2" VALUE="26">
<INPUT TYPE="CHECKBOX" NAME="Check2">Green Cotton Shirt<br>
<INPUT TYPE="HIDDEN" NAME="Shirt3" VALUE="27">
<INPUT TYPE="CHECKBOX" NAME="Check3">White Silk Shirt...
<P>
<INPUT TYPE="submit" NAME="Go" VALUE="Register!">
<INPUT TYPE="RESET" VALUE="Reset!">
</FORM>
💡 Why this matters: Hidden fields maintain state between steps without requiring server storage, making them efficient for passing data between forms in multi-step transactions.
Another option is to keep everything in databases, recording each step's information in appropriate tables and linking with a common ID. This is more costly and time-consuming.
Servlets can speed up processing but require solid programming knowledge.
Client server architecture
Client-server architecture can have different tiers depending on where data processing occurs.
-
1-tier architecture: Entire processing takes place at a single location. For example, processing occurs only in the main frame with other machines as display terminals (Fig. 1). Alternatively, all processing may occur at individual terminals with a file server that just stores files (Fig. 2).
-
2-tier architecture: Processing of HTML code occurs on the client side, while web page requests are processed on the server side (Fig. 3).
-
3-tier architecture: The database management system or application software is placed on a different processing tier than the web server (Fig. 4).
-
4-tier architecture: Additional processing zones, such as a payment processing system, can be placed at the 4th tier.
Architecture can be extended to n-tiers as needed.
Web server
A web server is a machine that serves web page requests to clients on the internet. It combines hardware and software. The type of web server depends on the volume and type of web activities. Transaction processing sites generating dynamic pages with high traffic need more efficient, easily upgradeable web server software.
Operating systems for web servers
An operating system is required for a computer to run programs and provide input/output services to connected devices. Commonly used web server operating systems include:
- Microsoft Windows NT Server
- Microsoft Windows 2000 Advanced Server
- Microsoft.NET Server
- Linux or Unix-based operating systems like Solaris
Unix-based web servers are more popular and considered more secure. Linux is an open source operating system that is fast, efficient, and easy to install. Open source software is developed by a community of programmers and available for download at no cost.
Web Server Software
Common examples of web server software include:
- Apache HTTP server: Open source code developed in 1994. It dominates the web because it is free and performs efficiently.
- MS Internet Information Server (IIS): Comes with MS Windows 2000 and NT operating systems. IIS's inclusion of ASP provides an environment where HTML pages and scripts combine to produce dynamic web pages.
- Sun ONE web server (also called iPlanet or Netscape): A joint product of AOL and Sun Microsystems. It runs on many operating systems including Solaris and Windows.
Web Server Hardware
Web server computers generally have more memory, larger and faster hard disk drives, and faster processors than typical desktop PCs. Companies like Dell, Hewlett Packard, and others sell web server hardware and provide configuration tools on their websites.
Performance of web server
Web server performance is evaluated based on two factors:
-
Throughput: The number of HTTP requests that a particular server hardware and software can handle in unit time.
-
Response time: The amount of time a web server requires to process one request.
Web server hardware architectures
Large e-commerce sites may need more than one computer within each tier. Two approaches exist:
- Centralized architecture: Using few but very fast and large computers within each tier.
- Decentralized architecture: Using many less powerful computers and dividing workload among them.
Web hosting choices
ISPs offer various web hosting arrangements:
- Shared hosting: A client's website is hosted on a server that simultaneously hosts other websites, operated by an ISP.
- Dedicated hosting: A web server is arranged for a single client who does not share it. In both shared and dedicated hosting, the ISP owns the hardware but leases it to the client and handles maintenance.
- Co-location hosting: ISP offers physical space for a client to install and maintain its own server hardware and software.
- Self hosting: Companies run a server in-house.
E-commerce software
The size and objectives of e-commerce sites vary, leading to diverse software and hardware products. All e-commerce software must provide:
- Catalog display
- Shopping cart capabilities
- Transaction processing
Large or complex sites also use software that adds:
- Middleware
- Application integration
- Web services
- Integration with ERP Software
- Supply chain management software
- Customer Relationship Management (CRM) Software
- Content Management Software
- Knowledge Management Software
Catalog display
A static catalog is a simple HTML list that requires editing HTML code to change. A dynamic catalog stores item information in a database (usually on a different computer accessible by the web server). It provides photos, detailed descriptions, and search facilities about item availability.
Shopping cart
Early form-based shopping carts required users to remember and type information. Modern electronic shopping carts/baskets automatically keep records of selected items, allow customers to view details, and enable adding or removing items. When a customer clicks an item, all details including price, product number, and order identifying information are stored automatically.
Transaction processing
Transaction processing occurs when a customer clicks the checkout or confirm order button and is subjected to payment processing. It represents the most complex part of online sales. Calculation of taxes, shipping costs, and obtaining updated shipping rates by connecting to shipping companies' websites are important parts.
Advanced functions of e-commerce software
Middleware connects e-commerce software with existing accounting systems.
Application integration ensures e-commerce application programs are compatible and fully integrated with Database Management Software. For example, if a company has an existing inventory database, the e-commerce application must support that system.
🔑 Definition — Web services: A combination of software tools that allow application software in one organization to communicate with other programs/applications over a network using a specific set of standard protocols.
📌 Example: A company wanting to gather all financial management information in one spreadsheet can use web services to automatically get bank account details, loan information, and stock values from different independent sources. Similarly, web services can obtain price and delivery information from different vendors, review this information, place orders to the right vendor, and track orders until shipment is received.
⭐ Key Takeaways
HTTP's stateless nature requires deliberate methods to maintain state across e-commerce transaction steps. The four main methods are server-side temporary files, cookies, hidden form fields, and database storage — each with different trade-offs in complexity and cost. Client-server architecture scales from simple 1-tier to complex n-tier systems, with each tier handling specific processing functions. Web server performance depends on throughput and response time, while hosting options range from shared to dedicated to co-location to self-hosting. Finally, e-commerce software must provide catalog display, shopping cart, and transaction processing, with advanced features like middleware, application integration, and web services enabling larger operations.
🧠 Quick Revision Questions
- What are the four main methods for maintaining state in a stateless HTTP system?
- How do hidden form fields maintain state between the "Add to Cart" and "Confirm Order" steps?
- What is the difference between 1-tier, 2-tier, and 3-tier client-server architectures?
- What two factors are used to evaluate web server performance?
- What is the difference between shared hosting, dedicated hosting, and co-location hosting?
📘 Lecture 20 — Integration with ERP Systems
📖 Overview: This lecture explores the integration of e-commerce systems with enterprise software, covering ERP, CRM, SCM, content and knowledge management, and e-commerce software platforms. It then dives deep into critical internet security threats, explaining various malicious programs, attack types, and protective measures essential for safe e-commerce operations.
🗂️ Topics Covered
The lecture begins by introducing Enterprise Resource Planning (ERP) and its integration with e-commerce, followed by Customer Relationship Management (CRM) and Supply Chain Management (SCM) software. It then covers Content Management and Knowledge Management software, lists notable e-commerce software, and explains software agents. The second half of the lecture comprehensively addresses internet security issues, including back doors, Trojan horses, viruses, worms, virus protection methods, hackers, active content threats (applets, JavaScript, ActiveX), and various network attack types like eavesdropping, password attacks, IP spoofing, man-in-the-middle attacks, and denial of service attacks.
📝 Lecture Summary
Integration with ERP Systems
Enterprise Resource Planning (ERP) is a concept that integrates all aspects of a business (e.g., accounting, logistics, manufacturing, marketing, planning, project management) at a single place. An ERP system such as SAP is expensive. E-commerce sites/software has to fully integrate with ERP software, wherever it is used.
Customer Relationship Management Software
The primary goal of Customer Relationship Management (CRM) is to understand each customer’s needs and customize the product/service to meet those needs. CRM software gathers data from customer’s activities on the web site of e-business. The software uses this data to help managers to conduct analytical study about their business/marketing.
Supply Chain Management (SCM) Software
Supply chain involves all activities associated with flow and transformation of goods from raw material stage to the finished stage and their supply to the end users. Supply Chain Management (SCM) software helps companies to coordinate planning and operations with their partners in industry. SCM planning software helps companies develop demand forecasts using information from each player in supply chain. SCM execution software helps with tasks such as the management of warehouses and transportation facilities.
Content Management Software
Companies have found it important to use the web to share corporate information among their employees, customers, suppliers, etc. Content Management Software helps companies control the large amounts of data, pictures/graphics and other files that play a crucial role in conducting business. It also offers different ways of accessing the corporate information which managers of a business might need for decision making.
Knowledge Management Software
Companies have started to find ways that help them manage the knowledge itself regardless of documentary representation of that knowledge. Software developed to meet this goal is called Knowledge Management Software. It has features that allow it to read documents in electronic format, scanned paper documents, e-mail messages, etc., so as to extract knowledge.
E-commerce Software
Following are the names of some well-known e-commerce software:
- Intershop Enfinity
- IBM’s WebSphere Commerce Professional Edition
- Microsoft Commerce Server 2002
Agents
An agent is a software program that is capable of autonomous action in its environment in order to meet its objectives. Agents can be used for comparisons, filtering, web crawling, auctions, etc. For example, there may be buyer agents and seller agents each with their goals and constraints. They can negotiate deals on behalf of the users. Agents can monitor health indicators and alert the individuals under given conditions.
Security issues over the internet
Security is the biggest factor slowing down the growth of e-commerce worldwide. For instance, when you enter your credit card no. in a text box, it is potentially exposed to millions of people on the internet and can be misused. It is important to know the following terms in connection with the security threats over the internet.
🔑 Security Threats Definition: Any malicious activity that compromises the confidentiality, integrity, or availability of information systems and data over the internet.
Back doors and Trojan horses
Back Doors are those hostile programs which, when run on a machine, install hidden services in order to give attackers remote access capabilities to a compromised machine. Trojan horses are those programs that appear harmless but actually have some malicious purpose. For example, HAPPY99.EXE is a Trojan horse that displays a firework and then sends copies of it to the e-mail addresses found on the system. The term Trojan Horse has been borrowed from history, referring to a huge wooden horse where the whole Greek army was hidden during a war, deceiving the enemy.
🔑 Back Door: A hostile program that installs hidden services to give attackers remote access to a compromised machine.
🔑 Trojan Horse: A program that appears harmless but has a malicious purpose.
Viruses and worms
Viruses and Worms are malicious programs that can travel between computers as attachments on email or independently over a network. These terms are sometimes used interchangeably; however, essentially they are different. Worms spread from computer to computer, but unlike viruses have the capability to travel without any help or human action. A worm can replicate itself, meaning it can send copies of itself to everyone listed in the email address box on a system. Viruses, on the other hand, need to be activated through a human action. Another difference is that viruses modify existing programs on a computer unlike worms which can install back doors or drop viruses on the system they visit. A few years ago a worm called 'Love Bug' was triggered by a 23 years old student in Philippine. Its code was written in VBScript, and it traveled on the internet as an email attachment. It could send copies of itself up to 300 addresses found in the email address box. It could destroy files on the system as well as search for any passwords and forward a list of the same to the attacker. Within days it spread to 40 million computers in more than 20 countries causing a financial loss of about $9 billion.
🔑 Virus: A malicious program that requires human action to activate and modifies existing programs on a computer.
🔑 Worm: A malicious program that can travel and replicate without human action, capable of sending copies of itself to email addresses.
📌 Example: The Love Bug worm (2000) — Written in VBScript, traveled as email attachment, sent copies to up to 300 email addresses, destroyed files, searched for passwords, spread to 40 million computers in 20+ countries, caused $9 billion loss.
Virus protection
- Install anti-virus software such as McAfee, Norton, Dr. Solomon, Symantec, etc.
- Downloading of plug-ins (programs that work with the browser to enhance its capabilities) from the internet should be avoided.
- Downloading of plug-ins should be done from the vendor's official website.
- Newly obtained disks, programs or files should be scanned for viruses before use.
- Installation of a firewall may also reduce the risk of virus attack.
Hackers
Hackers or crackers are those individuals who write programs or manipulate technologies to gain unauthorized access to computers and networks.
Active contents, active X control
Active content is a term generally used to refer to programs that are embedded in web pages to cause certain action. Malicious Active Content delivered through web pages can reveal credit card nos., user names, passwords, etc., and any other information stored in the cookie files on a system. Applets, JavaScript and Active X Controls can be used to install hidden services to the hacker. An Applet is a compiled Java program that runs on the client's machine when a particular web page request is made. Some malicious content can be sent by the hacker embedded in the Applet. Through JavaScript attacks a hacker can destroy the hard disk, disclose emails in the mailbox, or get any sensitive information. JavaScript programs can read list of URLs visited and seize information in the web forms. For example, if a user enters a credit card no. in the form, JavaScript code can send a copy of it to the hacker. Moreover, malicious content can be delivered through cookies using JavaScript that can reveal contents of files or destroy files. Active X Controls are those objects which contain programs placed on web pages to perform particular tasks. They can originate from many languages (C, Visual Basic, etc.). When downloaded they can run on client machine like any other program. A hostile Active X Control can reformat a user's hard disk, send e-mails to all people listed in the mailbox, or even shut down computers.
🔑 Active Content: Programs embedded in web pages that cause certain actions, which can be malicious.
📌 Example: JavaScript attack on a web form — When a user enters a credit card number, JavaScript code can send a copy to the hacker.
💡 Why this matters: Active content is a primary vector for client-side attacks in e-commerce, as users unknowingly download and execute malicious programs when visiting compromised websites.
Outside attacks on a network
Eavesdropping/sniffing/snooping
In this type of attack the hacker has the ability to monitor network traffic using some kind of network-monitoring software. For example, a hacker may install some backdoor or Trojan horse that can monitor the key strokes of a user while typing and send the typed information to the hacker.
🔑 Eavesdropping (Sniffing/Snooping): Monitoring network traffic using network-monitoring software to capture sensitive information.
Password attacks
Such attacks are basically a result of eavesdropping through which the hacker is able to know the account ID or password of a particular user. Then using it the hacker gains access to the network and gather information such as user names, passwords, computer names, resources, etc. That can lead to modification, deletion, or rerouting of network data.
🔑 Password Attack: Gaining unauthorized access by obtaining account IDs and passwords through eavesdropping.
IP address spoofing
There are two IP addresses available on a data packet – IP addresses of the sender and the destination. The address of the destination only matters for routing. It is possible that a hacker (having special capabilities) seizes the control of a router, changes the IP address of the source/sender on data packets, and thus forces the destination machine to send the information/web page to a different machine — that is, the machine of the hacker. This is called IP address spoofing.
🔑 IP Address Spoofing: A hacker seizes control of a router and changes the source IP address on data packets to redirect information to the hacker's machine.
Man in the middle attacks
In it the attacker is able to monitor, capture, and control data between sending and receiving machines. He may apply IP address spoofing technique to divert the packets to its machine, then modify the packets and resend the misleading information to the actual client. Another form of man-in-the-middle attack is where the hacker is able to substitute the IP address of a genuine web site with the IP address of his own web site due to some security hole in the software that runs on a domain name server. A client would think that he is communicating or receiving the information from a genuine web site, though it would not be the case actually.
🔑 Man-in-the-Middle Attack: An attacker monitors, captures, and controls data between two communicating machines, potentially modifying packets or substituting IP addresses.
Denial of services (DOS) attacks
In this type of attack, the attacker gains access to the network and then sends invalid data to network services or applications. These services or applications consequently become unable to perform their normal tasks or functions. Hence, sending a flood of data to a particular service or computer can cause it to overload or shutdown. This attack is specially used to take down websites on the internet, when repeated requests for web pages are deliberately initiated so as to choke down a web server. In early 2000 this attack was launched against some famous ecommerce web sites. Hackers arranged computers with special software initiating thousands of http requests per second for specific web sites causing the web servers to overload. Thus, these servers were made unable to fulfill the web page requests of the genuine users/clients. In distributed denial of service attack, the compromised system itself is used as a source for further attacks. The use of firewalls and a proper Intrusion Detection System (IDS) can minimize the risk of a DOS attack. It is also important to establish a security policy for an e-business organization outlining which assets have to be protected and how to be protected.
🔑 Denial of Service (DOS) Attack: Sending invalid data or a flood of requests to overload a service or computer, making it unable to perform normal functions.
🔑 Distributed Denial of Service (DDOS) Attack: A DOS attack where compromised systems are used as sources for further attacks.
📌 Example: Early 2000 DOS attacks on famous ecommerce websites — Hackers used computers with special software initiating thousands of HTTP requests per second, causing web servers to overload and deny service to genuine users.
⭐ Key Takeaways
This lecture emphasizes that e-commerce systems must integrate with enterprise software like ERP, CRM, SCM, and content/knowledge management systems to function effectively. The most critical security concepts include understanding the differences between viruses (requiring human action) and worms (self-replicating), with the Love Bug worm exemplifying the devastating global impact of worms. Active content threats via applets, JavaScript, and ActiveX controls pose serious client-side risks as they can execute malicious code on user machines. Network attacks such as eavesdropping, IP spoofing, man-in-the-middle, and DOS attacks require robust defenses including firewalls, intrusion detection systems, and comprehensive security policies. For the exam, students must distinguish between attack types, recall specific examples (like Happy99 and Love Bug), and understand protective measures against each threat.
🧠 Quick Revision Questions
- What is the key difference between a virus and a worm in terms of how they spread?
- How does a man-in-the-middle attack differ from IP address spoofing?
- What was the Love Bug worm, and what specific damages did it cause?
- List three types of active content that can be used to deliver malicious code through web pages.
- What is the primary goal of a Denial of Service (DOS) attack, and what protective measures can minimize its risk?
📘 Lecture 21 — Firewalls
📖 Overview: This lecture covers the fundamental concepts of network security, focusing on firewalls and their types, proxy servers, virtual private networks (VPNs), and cryptography. Understanding these topics is crucial for protecting organizational networks from external threats and enabling secure e-commerce transactions.
🗂️ Topics Covered
The lecture begins by defining a firewall as a hardware/software combination positioned between the internet and an internal network. It then details three main types of firewalls: packet filter, circuit level, and application gateway. The discussion extends to proxy servers and their caching capabilities, followed by an explanation of virtual private networks (VPNs) using dial-up and internet-based connections. Finally, the lecture addresses security challenges in e-commerce, introduces cryptography as the primary solution, and describes substitution and transposition encryption techniques.
📝 Lecture Summary
Firewalls
A firewall is a combination of hardware and software that sits between the internet and the internal network of an organization. It examines data entering or leaving the network and filters it according to certain rules to protect the network from outside attacks.
🔑 Definition — Firewall: A hardware and software combination that sits between the internet and an internal network, examining and filtering data according to set rules to protect the network from attack.
Packet filter firewall
This type uses a set of rules to determine whether outgoing or incoming data packets are allowed to pass through the firewall. For example, we can specify IP addresses of sending devices such that packets from these IP addresses are not allowed to enter the network. A packet filter firewall is the simplest type and operates at the data link and network layers of the OSI model.
🔑 Definition — Packet Filter Firewall: A simple firewall that uses rules to filter data packets based on IP addresses, operating at the data link and network layers of the OSI model.
Circuit level firewall
This firewall is similar to the packet filter firewall but operates at the transport layer of the OSI Model, providing greater functionality. It can make packets sent from the internal network to a destination outside the firewall appear as if they originated at the firewall, keeping host information secret. It can also determine whether a TCP/IP connection between a host and an outside machine has been properly established, allowing it to cut off hijacked connections.
🔑 Definition — Circuit Level Firewall: A firewall operating at the transport layer that can hide internal host information and detect properly established TCP/IP connections to prevent hijacking.
Application gateway firewall
This firewall operates at the application layer of the OSI Model and uses strong user authentication to verify host identity. Unlike packet filter firewalls, it filters requests rather than packets. It can block outgoing HTTP or FTP requests and prevent employees from downloading dangerous programs or connecting to certain websites. Circuit level capabilities can be combined with application gateway services to form a hybrid type of firewall.
🔑 Definition — Application Gateway Firewall: A firewall operating at the application layer that filters requests and uses strong user authentication to control connections.
Proxy server
A proxy server sits between an internal trusted network and the untrusted internet. It performs three main functions: it hides host information by affixing its own IP address instead of the requesting machine's IP, acts as a firewall filtering requests for certain web pages, and speeds up processing of HTTP requests by caching web pages. Caching stores requested web pages in memory for a certain period, reducing the time needed to supply subsequent page requests.
🔑 Definition — Proxy Server: A server between a trusted network and the internet that hides host information, filters requests, and caches web pages to speed up processing.
Virtual private network (VPN)
A VPN is a secure, dedicated point-to-point connection over the internet. It uses internet infrastructure instead of special telephone lines. Both the Remote Access Server (RAS) or tunnel server and the Remote Access Client (RAC) or tunnel client are connected to the internet. The client specifies the tunnel server's IP address during configuration. VPN connections are managed by Point to Point Tunneling Protocol (PPTP), which uses encryption to provide secure transport over the public internet. VPN is a cost-saving measure compared to dial-up connections, as clients incur only local call costs to their ISP while maintaining long connections to remote networks.
🔑 Definition — Virtual Private Network (VPN): A secure, dedicated point-to-point connection over the internet using encryption and tunneling protocols.
Security – the biggest challenge
The issue of computer and data security is the biggest hurdle in e-commerce growth. Programs running on servers can damage databases, terminate server software, or alter information. Two organizations combat these threats: Computer Emergency Response Team (CERT) and Systems Administrator, Audit, Network and Security Institute (SANS Institute). The best response from experts is cryptography.
Cryptography
Cryptography is the technique of converting a message into unintelligible form so that unauthorized persons cannot understand it. Two basic techniques are used: substitution, which replaces each letter with another (e.g., "a" with "d", "b" with "e"), and transposition, which scrambles characters by writing a message into a table row by row then reading it column by column. Historically, cryptography has been used for military purposes (Julius Caesar used transposition ciphers; Hitler used the Enigma encryption cipher) and non-military purposes (protecting religious secrets, science, and industry). Today, it has made rapid commercialization of the internet possible, enabling secure online banking and business transactions.
🔑 Definition — Cryptography: The technique of converting a message into an unintelligible form to prevent unauthorized understanding.
📐 Formula: Substitution → Each letter is replaced with another according to a fixed pattern. 📐 Formula: Transposition → Characters are scrambled by reorganizing their positions (e.g., writing row by row, reading column by column).
📌 Example: For transposition, the message is first written into a table row by row, then read and rewritten column by column to create a scrambled version.
💡 Why this matters: Cryptography enables secure e-commerce by protecting sensitive data during transmission, making it possible for banks, businesses, and individuals to conduct transactions online safely.
⭐ Key Takeaways
Firewalls are essential network security tools that filter traffic based on rules, with packet filter, circuit level, and application gateway types operating at different OSI layers with increasing sophistication. Proxy servers add caching capabilities to improve performance while hiding internal network information. VPNs provide cost-effective secure remote access over the internet using tunneling and encryption, offering a cheaper alternative to dial-up connections. Cryptography, through substitution and transposition techniques, is the fundamental solution to security threats in e-commerce, enabling secure online transactions. The biggest challenge to e-commerce growth remains computer and data security, addressed by organizations like CERT and SANS Institute.
🧠 Quick Revision Questions
- What are the three main types of firewalls, and which OSI model layer does each operate at?
- How does a proxy server improve web page loading speed, and what is the term for this process?
- Compare the cost implications of using a VPN versus a dial-up connection for remote access.
- What are the two basic cryptographic techniques described in the lecture, and how do they differ?
- Which protocol manages VPN connections and provides secure transport over the public internet?
📘 Lecture 22 — CRYPTOGRAPHY
📖 Overview: This lecture introduces cryptography as a mathematical technique for ensuring confidentiality of information. It explains symmetric and asymmetric cryptography, and then focuses on how digital signatures, digital certificates, and certification authorities work together to provide authenticity, integrity, and non-repudiation in electronic communications. Understanding these concepts is crucial for secure e-commerce transactions.
🗂️ Topics Covered
The lecture covers the definition and types of cryptography (symmetric and asymmetric/public key), electronic/digital signatures and their properties (authenticity, integrity, non-repudiation), digital certificates and the X.509 standard, certification authorities (CAs) and their hierarchical structure, the process of verifying public key ownership through certificate chains, and the role of trust levels and certificate classes in ensuring secure communications.
📝 Lecture Summary
CRYPTOGRAPHY
Cryptography is a collection of mathematical techniques used to ensure confidentiality of information. The process of scrambling a message with the help of a key is called encryption. The process of unscrambling a message using an appropriate key is called decryption. Keys are numbers or characters that are randomly generated with the help of some cryptographic algorithm. Pretty Good Privacy (PGP) is the name of a popular cryptographic system which is available for general public use. There are two types of cryptography - Symmetric and Asymmetric cryptography.
🔑 Definition — Cryptography: A collection of mathematical techniques used to ensure confidentiality of information.
Symmetric Cryptography
In symmetric cryptography same keys are used for encryption and decryption.
🔑 Definition — Symmetric Cryptography: A type of cryptography where the same key is used for both encryption and decryption.
Asymmetric or Public Key Cryptography
In this type a pair of public and private keys is used for encryption and decryption.
🔑 Definition — Asymmetric (Public Key) Cryptography: A type of cryptography where a pair of keys (public and private) is used; one key encrypts and the other decrypts.
Digital/electronic signature
An electronic signature means any letters, numbers, symbols, images, characters or any combination thereof in electronic form applied to an electronic document which can ensure authenticity, integrity and non-repudiation. It uses public key cryptography. Authenticity means that the message is from a particular source/individual. Integrity means that the message has not been altered during transmission. Non-repudiation means that the execution of the digital signatures cannot be denied by the one who is alleged to be the signer.
🔑 Definition — Digital/Electronic Signature: Letters, numbers, symbols, images, or characters in electronic form applied to an electronic document to ensure authenticity, integrity, and non-repudiation.
🔑 Definition — Authenticity: The property that a message is from a particular source/individual.
🔑 Definition — Integrity: The property that a message has not been altered during transmission.
🔑 Definition — Non-repudiation: The property that the execution of a digital signature cannot be denied by the alleged signer.
Digital certificates
These are the certificates in electronic form which establish whether or not a public key belongs to the purported owner. A digital certificate at least comprises a public key, certification information (name, ID etc.) and electronic signatures of a certification authority. Digital certificates are prepared according to a generally accepted format called X.509 standard format.
🔑 Definition — Digital Certificate: An electronic certificate that establishes whether a public key belongs to the purported owner, comprising at least a public key, certification information, and the electronic signature of a certification authority.
📐 Formula: X.509 → The generally accepted standard format for digital certificates.
Certification authority (CA)
A certification authority is defined to be a trusted public/private body that attests the association of a particular individual with his/her corresponding public key. A CA signs digital certificates with its private key. There are many CAs working in the field but the pioneering or the most reputed CA is Verisign which is based in America.
Certification authorities work in a hierarchical fashion. There is the CA at the top called root CA (the most reputed CA). It can issue certificates to CAs working below it and those CAs can further issue certificates to CAs working under them. In this fashion a hierarchy of CAs is developed with each CA confirming the public key of the CA below it through a digital certificate.
🔑 Definition — Certification Authority (CA): A trusted public/private body that attests the association of a particular individual with his/her corresponding public key.
🔑 Definition — Root CA: The most reputed CA at the top of the hierarchy that can issue certificates to CAs working below it.
📌 Example: A user wants to send an encrypted message to Mr. A. The user accesses a key server to find Mr. A's public key. The user discovers that CA1 (a lower-level CA) issued a digital certificate to Mr. A and signed it with its private key. If the user trusts CA1, the public key can be used. If not, the user checks whether CA2 issued a certificate certifying CA1's public key. The user continues up the hierarchy to the root CA (e.g., Verisign). If all certificates in the chain are available, maximum trust is established. If the chain is broken or any certificate is missing, trust is reduced.
💡 Why this matters: This hierarchical system of CAs creates a "web of trust" where the reputation of higher-level CAs provides assurance that a public key genuinely belongs to a specific individual. The root CA carries the most trust because it conducts the most thorough verification before issuing certificates.
Trust Levels and Certificate Classes
The greater the reputation of a CA, the more trust a certificate issued by it carries. If Mr. A has a certificate directly from the root CA (e.g., Verisign), his public key would be most trustworthy because Verisign would have done detailed investigation before issuing it. Obtaining a certificate from a top-level, more reputed CA costs more. There are different levels of certificates attaching different levels of trust, such as Class A, B, or C type certificates. A Class A certificate carries more trust and costs more than Class B or C, but involves a greater level of investigation before issuance.
🔑 Definition — Certificate Class: A classification of digital certificates (e.g., Class A, B, C) that indicates the level of trust and verification involved, with higher classes offering greater trust but costing more.
📌 Example: The role of a CA is analogous to a passport office. A passport office issues a passport only after detailed verification of a person's identity, confirming they are entitled to travel. Similarly, a reputed CA issues a digital certificate only after verifying that a public key belongs to a specific individual, confirming to others that the key belongs to that person.
Verification and Fraudulent Keys
CAs are used for the verification of identity of a person. Ideally, Mr. A personally hands over his public key. However, if a user searches for Mr. A's public key on a key server, there may be multiple public keys (3, 4, or 5) against the same particulars, all certified by different CAs. Only one key is genuine; the rest are fraudulent keys registered by fraudulent people using Mr. A's particulars. The user should use the public key certified by the most reputed CA among all CAs. The objective of obtaining fraudulent keys is to intercept/receive messages intended for a particular receiver. CAs are supposed to issue certificates only after proper enquiry, otherwise they may be held liable under different laws.
🔑 Definition — Fraudulent Key: A public key registered fraudulently using another person's particulars to intercept messages intended for that person.
💡 Why this matters: Despite the loophole that fraudulent keys can be obtained, the system of certificates is believed to be the best for confirming authenticity of a person. It is impractical to personally obtain a public key from someone in another country; using a key server with certificates from reputed CAs is more convenient, practical, and time-saving for global internet communication.
⭐ Key Takeaways
Cryptography uses mathematical techniques to ensure confidentiality through encryption and decryption with keys. Symmetric cryptography uses the same key for both processes, while asymmetric (public key) cryptography uses a public-private key pair. Digital signatures provide authenticity, integrity, and non-repudiation by using public key cryptography. Digital certificates, following the X.509 standard, establish the association between a public key and its owner and are issued by certification authorities (CAs). CAs operate in a hierarchy with a root CA at the top, with higher-level CAs carrying more trust but charging more for their certificates, and different classes (A, B, C) reflect varying levels of verification and trust.
🧠 Quick Revision Questions
- What are the two main types of cryptography, and how do they differ in the keys used for encryption and decryption?
- What three properties does a digital signature ensure, and what does each property mean?
- What is the minimum content of a digital certificate, and what standard format is used for these certificates?
- Explain the hierarchical structure of certification authorities and how trust is established through a certificate chain up to the root CA.
- Why might multiple public keys exist for the same individual on a key server, and how should a user determine which key to trust?