Transcription

Fundamentals ofgs/ilWeb ProgrammingDCAP202EditororAnuj Sharmanil Sharma

www.lpude.inDIRECTORATE OF DISTANCE EDUCATIONFUNDAMENTALS OF WEBPROGRAMMINGEdited ByAnuj Sharma

ISBN: 978-93-87034-78-5Printed byEXCEL BOOKS PRIVATE LIMITEDRegd. Office: E-77, South Ext. Part-I, Delhi-110049Corporate Office: 1E/14, Jhandewalan Extension, New Delhi-110055 91-8800697053, celbooks.comforLovely Professional UniversityPhagwara

CONTENTSUnit 1:Internet BasicPawan Kumar, Lovely Professional University1Unit 2:HTML IntroductionSahil Rampal, Lovely Professional University15Unit 3:HTML Command and StructureSarabjit Kumar, Lovely Professional University24Unit 4:HTML ListRamandeep Kaur, Lovely Professional University37Unit 5:Creating TablesRamandeep Kaur, Lovely Professional University45Unit 6:Introduction to JavaScriptManmohan Sharma, Lovely Professional University63Unit 7:Operators in JavaScriptManpreet Kaur, Lovely Professional University79Unit 8:Programming Constructs in JavaScriptSarabjit Kumar, Lovely Professional University89Unit 9:DOM ModelAnil Sharma, Lovely Professional University110Unit 10:Browser ObjectsManpreet Kaur, Lovely Professional University123Unit 11:Handling Events Using JavaScriptPawan Kumar, Lovely Professional University134Unit 12:HTML FormsManpreet Kaur, Lovely Professional University139Unit 13:Building Object of JavaScriptDeepak Mehta, Lovely Professional University150Unit 14:DHTMLMithilesh Kumar Dubey, Lovely Professional University161

SYLLABUSFundamentals of Web ProgrammingObjectives: To impart the skills needed for web programming, web administration, and web site development.Sr. No.Topics1.Internet Basic: Basic Concepts, Communicating on the Internet, Internet Domains, Establishing connectivity tothe Internet, Client IP Address, IP Address, TCP/IP2.HTML: Introduction, Web Server, Web Client/ Browser, HTML Tags3.HTML: Commonly used HTML Commands, Structure of HTML Program, Formatting, Text Styles, Text Effects4.HTML: HTML Lists, Types of lists, Adding graphics to HTML Document5.HTML: Creating tables, Linking documents, Frames6.Introduction to Javascript: Javascript and Web. script Tag and browsers compatibility. Data types: Numeric, Text,Boolean, Type casting, Arrays7.Javascript: Operators and expressions in Javascript, Programming Constructs, Conditional and Looping Statements,Functions, User defined functions, Dialog Boxes8.DOM Model: Understanding DOM Model, Objects in HTML, Browser Objects, window, history, location, navigator,document object. Handling Events using Javascript9.HTML Forms: Properties and Methods, Button, Text, Text Area, Checkboxes, radio buttons, select and option elements,Built-In objects in Javascript, String Object, Math Object, Date Object, User Defined objects10.DHTML: Cascading Style Sheets, Class, External Style Sheets

Pawan Kumar, Lovely Professional UniversityUnit 1: Internet BasicUnit 1: Internet BasicNotesCONTENTSObjectivesIntroduction1.1Basic Concept1.1.1Browsers1.1.2Websites1.1.3Web Addresses1.2Communicating on Internet1.3Internet Domain1.41.51.3.1Domain Names1.3.2Host Name1.3.3Domain Name SystemEstablishing Connectivity to the Internet1.4.1Enable and Disable Automatic Wireless Network Configuration1.4.2Available Networks1.4.3Preferred NetworkClient IP Address1.5.11.61.7Using the CodeIP Address1.6.1Network Part of IP Address1.6.2Local Host Part of the IP Address1.6.3IP Address Classes and their Formats1.6.4Relation of IP Address to Physical Address1.6.5Static Vs Dynamic IP AddressTCP/IP (Transmission Control Protocol/Internet Protocol)1.7.1TCP/IP Protocol Architecture1.8Summary1.9Keywords1.10 Review Questions1.11 Further ReadingsLOVELY PROFESSIONAL UNIVERSITY1

Fundamentals of Web ProgrammingNotesObjectivesAfter studying this unit, you will be able to: Discuss the basic concept of Internet Explain the communication on the Internet Discuss Internet Domain Describe establishing connectivity to the InternetIntroductionThe Internet carries a vast array of information resources and services, most notably theinter-linked hypertext documents of the World Wide Web (WWW) and the infrastructure tosupport electronic mail, in addition to popular services such as online chat, file transfer and filesharing, online gaming, and Voice over Internet Protocol (VoIP) person-to-personcommunication via voice and video.1.1 Basic ConceptIt is a network of networks that consists of millions of private and public, academic, business,and government networks of local to global scope that are linked by copper wires, fiber-opticcables, wireless connections, and other technologies.1.1.1 BrowsersA browser is a software application which enables a user to display and interact with text,images, videos, music, and other information that could be on a website. Text and images on aweb page can contain hyperlinks to other web pages at the same or different website.Browsers allow a user to quickly and easily access information provided on many web pages atmany websites by traversing these links.1.1.2 WebsitesA website is a collection of web pages (documents that are accessed through the Internet).A web page is what you see on the screen when you type in a web address, click on a link, or puta query in a search engine. A web page can contain any type of information, and can include text,color, graphics, animation and sound.When someone gives you their web address, it generally takes you to their website’s homepage, which should introduce you to what that site offers in terms of information or otherservices. From the home page, you can click on links to reach other sections of the site.!Caution A website can consist of one page, or of tens of thousands of pages, depending onwhat the site owner is trying to accomplish.1.1.3 Web AddressesA Web address, or domain name, is an address where you can be found online. It’s how you’llexpress yourself through email or your website and it’s what customers think of when trying tofind you.2LOVELY PROFESSIONAL UNIVERSITY

Unit 1: Internet BasicNotesSelf AssessmentFill in the blanks:1.A . is a software application which enables a user to display and interactwith text, images, videos, music, and other information that could be on a website.2.A . is what you see on the screen when you type in a web address, click ona link, or put a query in a search engine.3.A ., or domain name, is an address where you can be found online.1.2 Communicating on InternetCommunication is the most popular use of the Internet, with email topping the list of all thetechnologies used. Some of the types of communication technologies used also include emaildiscussion groups, Usenet news, chat groups, and IRC. These are unique to networked computerenvironments and have come into wide popularity because of the Internet. Other technologies,including video and audio conferencing and Internet telephony, are also available on the Internet.They require more multimedia capabilities of computer systems and are more taxing of networkresources than the others. They also are adaptations of other technologies to the Internet.Most of the technologies that are unique to the Internet require communication to be done intext—letters with some symbols and punctuation.Notes Communicating effectively involves taking the time, except in informalcommunications, to use correct grammar, spelling, and punctuation and writing anappropriate message. When replying to a message include the pertinent parts of themessage and use an appropriate and interesting subject header in any case.Self AssessmentState True or False:4.Communication technologies are unique to networked computer environments and havecome into wide popularity because of the Internet.5.Communication technologies does not require more multimedia capabilities of computersystems and are more taxing of network resources than the others.1.3 Internet DomainAn internet domain name is an identification label that defines a realm of administrativeautonomy, authority, or control in the Internet, based on the Domain Name System (DNS).1.3.1 Domain NamesA domain name is an identification string that defines a realm of administrative autonomy,authority, or control on the Internet. Domain names are formed by the rules and procedures ofthe Domain Name System (DNS). Technically, any name registered in the DNS is a domainname.LOVELY PROFESSIONAL UNIVERSITY3

Fundamentals of Web ProgrammingNotesExample: The domain name microsoft.com represents about a dozen IP addresses.Domain names are used in URLs to identify particular Web pages. For example, in the URLhttp://www.abc.com/index.html, the domain name is abc.com. Every domain name has a suffixthat indicates which Top Level Domain (TLD) it belongs to. There are only a limited number ofsuch domains. For example:Figure 1.1: Examples of Domain NamesGovGovernment AgenciesEduEducational InstitutionsOrgOrganizational (nonprofit)MilMilitaryComCommercial BusinessNetNetwork OrganizationscaCanadathThailand1.3.2 Host NameA name is a label that is used to distinguish one thing from another. A person's name, forinstance, comprises a set of alphabetic characters that allows a person to be individually addressed.Computers are also named to differentiate one machine from another and to allow for suchactivities as network communication.A hostname is a label that is assigned to a device connected to a computer network and that isused to identify the device in various forms of electronic communication such as the WorldWide Web, e-mail or Usenet. Hostnames may be simple names consisting of a single word orphrase, or they may have appended a domain name, which is a name in a Domain Name System(DNS), separated from the host specific label by a period (dot). In the latter form, the hostnameis also called a domain name.Did u know? If the domain name is completely specified including a top-level domain ofthe Internet, then the hostname is said to be a Fully Qualified Domain Name (FQDN).The true "name" a computer needs in order to communicate on a network is actually a set ofnumbers. The original computers connected as the Internet used small integers as the hostnumber. For TCP/IP, the main protocol used by the Internet, each computer has a network IPaddress that follows a specific set of rules to assure its uniqueness and validity. (Additionally,port numbers further specify the access points for particular services on a computer).1.3.3 Domain Name SystemThe DNS translates Internet domain and host names to IP addresses. DNS automatically convertsthe names we type in our Web browser address bar to the IP addresses of Web servers hostingthose sites.An often-used analogy to explain the Domain Name System is that it serves as the phone bookfor the Internet by translating human-friendly computer hostnames into IP addresses.Example: The domain name www.example.com translates to the addresses 192.0.43.10(IPv4) and 2001:500:88:200::10 (IPv6).4LOVELY PROFESSIONAL UNIVERSITY

Unit 1: Internet BasicUnlike a phone book, the DNS can be quickly updated, allowing a service's location on thenetwork to change without affecting the end users, who continue to use the same host name.Users take advantage of this when they use meaningful Uniform Resource Locators (URLs) ande-mail addresses without having to know how the computer actually locates the services.NotesReal Life ExampleA lot of what has been discussed may be a bit confusing, so lets do a real life example. In theflowchart below labeled Figure 1.2, you will see a computer trying to connect to www.google.comand the steps it takes.Figure 1.2: Computer Trying to Connect to www.google.comWe will discuss these steps below:1.A User opens a web browser and tries to connect to www.google.com. The operatingsystem not knowing the IP Address for www.google.com, asks the ISP's DNS Server forthis information.2.The ISP's DNS Server does not know this information, so it connects to a Root Server tofind out what name server, running somewhere in the world, know the information aboutgoogle.com.3.The Root Server tells the ISP's DNS Server to contact a particular name server that knowsthe information about google.com.4.The ISP's DNS Server connects to Google's DNS server and asks for the IP Address forwww.google.com.5.Google's DNS Server responds to the ISP's DNS server with the appropriate IP Address.LOVELY PROFESSIONAL UNIVERSITY5

Fundamentals of Web ProgrammingNotes6.The ISP's DNS Server tells the User's operating system the IP Address for google.com.7.The operating system tells the Web Browser the IP Address for www.google.com.8.The web browser connects and starts communication with www.google.com.Self AssessmentFill in the blanks:6.A . is an identification string that defines a realm of administrative autonomy,authority, or control on the Internet.7.A . is a label that is assigned to a device connected to a computer networkand that is used to identify the device in various forms of electronic communication.1.4 Establishing Connectivity to the InternetAll modern computers and laptops are capable of connecting to the internet, as are many otherdevices, including mobiles, tablets, e-readers, televisions, video games consoles.There are two ways of getting the internet at home. The most popular way is to have yourtelephone line (also known as a 'landline') converted to broadband so that it can carry normalphone calls and internet data at the same time.However, if you don't have a landline or if you want to be able to use the internet when you'reout and about, you might prefer mobile internet from one of the mobile network providers.This can be used anywhere there's a mobile signal but does tend to be slower and more expensivethan broadband through a landline.Follow these step-by-step instruction