HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Internet & World Wide Web How to Program, 5/e is appropriate for both introductory and intermediate-level client-side and server-side programming courses. The book is also suitable for professionals who want to update their skills with the latest Internet and web programming technologies.
Internet and World Wide Web How to Program, 5e introduces students with little or no programming experience to the exciting world of Web-Based applications. This new edition focuses on HTML5 and the related technologies in its ecosystem, diving into the exciting new features of HTML5, CSS3, the latest edition of JavaScript (ECMAScript 5) and HTML5 canvas. At the heart of the book is the Deitel signature “live-code approach”–concepts are presented in the context of complete working HTML5 documents, CSS3 stylesheets, JavaScript scripts, XML documents, programs and database files, rather than in code snippets. Each complete code example is accompanied by live sample executions.The Deitels focus on popular key technologies that will help readers build Internet- and web-based applications that interact with other applications and with databases. These form the basis of the kinds of enterprise-level, networked applications that are popular in industry today. After mastering the material in this book, readers will be well prepared to build real-world, industrial strength, Web-based applications.
Preface xix
Before You Begin xxxi
1 Introduction to Computers and the Internet 1
1.1 Introduction 2
1.2 The Internet in Industry and Research 3
1.3 HTML5, CSS3, JavaScript, Canvas and jQuery 6
1.4 Demos 9
1.5 Evolution of the Internet and World Wide Web 10
1.6 Web Basics 12
1.7 Multitier Application Architecture 16
1.8 Client-Side Scripting versus Server-Side Scripting 17
1.9 World Wide Web Consortium (W3C) 18
1.10 Web 2.0: Going Social 18
1.11 Data Hierarchy 23
1.12 Operating Systems 25
1.12.1 Desktop and Notebook Operating Systems 25
1.12.2 Mobile Operating Systems 26
1.13 Types of Programming Languages 27
1.14 Object Technology 29
1.15 Keeping Up-to-Date with Information Technologies 31
2 Introduction to HTML5: Part 1 37
2.1 Introduction 38
2.2 Editing HTML5 38
2.3 First HTML5 Example 38
2.4 W3C HTML5 Validation Service 41
2.5 Headings 41
2.6 Linking 42
2.7 Images 45
2.7.1 alt Attribute 47
2.7.2 Void Elements 47
2.7.3 Using Images as Hyperlinks 47
2.8 Special Characters and Horizontal Rules 49
2.9 Lists 51
2.10 Tables 54
2.11 Forms 58
2.12 Internal Linking 65
2.13 meta Elements 67
2.14 Web Resources 69
3 Introduction to HTML5: Part 2 76
3.1 Introduction 77
3.2 New HTML5 Form input Types 77
3.2.1 input Type color 80
3.2.2 input Type date 82
3.2.3 input Type datetime 82
3.2.4 input Type datetime-local 82
3.2.5 input Type email 83
3.2.6 input Type month 84
3.2.7 input Type number 84
3.2.8 input Type range 85
3.2.9 input Type search 85
3.2.10 input Type tel 86
3.2.11 input Type time 86
3.2.12 input Type url 87
3.2.13 input Type week 87
3.3 input and datalist Elements and autocomplete Attribute 87
3.3.1 input Element autocomplete Attribute 87
3.3.2 datalist Element 90
3.4 Page-Structure Elements 90
3.4.1 header Element 96
3.4.2 nav Element 96
3.4.3 figure Element and figcaption Element 96
3.4.4 article Element 96
3.4.5 summary Element and details Element 96
3.4.6 section Element 96
3.4.7 aside Element 96
3.4.8 meter Element 97
3.4.9 footer Element 98
3.4.10 Text-Level Semantics: mark Element and wbr Element 98
4 Introduction to Cascading Style SheetsTM (CSS): Part 1 105
4.1 Introduction 106
4.2 Inline Styles 106
4.3 Embedded Style Sheets 108
4.4 Conflicting Styles 111
4.5 Linking External Style Sheets 114
4.6 Positioning Elements: Absolute Positioning, z-index 116
4.7 Positioning Elements: Relative Positioning, span 118
4.8 Backgrounds 120
4.9 Element Dimensions 122
4.10 Box Model and Text Flow 123
4.11 Media Types and Media Queries 127
4.12 Drop-Down Menus 130
4.13 (Optional) User Style Sheets 132
4.14 Web Resources 136
5 Introduction to Cascading Style SheetsTM
(CSS): Part 2 142
5.1 Introduction 143
5.2 Text Shadows 143
5.3 Rounded Corners 144
5.4 Color 145
5.5 Box Shadows 146
5.6 Linear Gradients; Introducing Vendor Prefixes 148
5.7 Radial Gradients 151
5.8 (Optional: WebKit Only) Text Stroke 153
5.9 Multiple Background Images 153
5.10 (Optional: WebKit Only) Reflections 155
5.11 Image Borders 156
5.12 Animation; Selectors 159
5.13 Transitions and Transformations 162
5.13.1 transition and transform Properties 162
5.13.2 Skew 164
5.13.3 Transitioning Between Images 165
5.14 Downloading Web Fonts and the @font-face Rule 166
5.15 Flexible Box Layout Module and :nth-child Selectors 168
5.16 Multicolumn Layout 171
5.17 Media Queries 173
5.18 Web Resources 177
6 JavaScript: Introduction to Scripting 185
6.1 Introduction 186
6.2 Your First Script: Displaying a Line of Text with JavaScript in a Web Page 186
6.3 Modifying Your First Script 189
6.4 Obtaining User Input with prompt Dialogs 192
6.4.1 Dynamic Welcome Page 192
6.4.2 Adding Integers 196
6.5 Memory Concepts 199
6.6 Arithmetic 200
6.7 Decision Making: Equality and Relational Operators 202
6.8 Web Resources 207
7 JavaScript: Control Statements I 214
7.1 Introduction 215
7.2 Algorithms 215
7.3 Pseudocode 215
7.4 Control Statements 215
7.5 if Selection Statement 218
7.6 if...else Selection Statement 219
7.7 while Repetition Statement 223
7.8 Formulating Algorithms: Counter-Controlled Repetition 225
7.9 Formulating Algorithms: Sentinel-Controlled Repetition 228
7.10 Formulating Algorithms: Nested Control Statements 234
7.11 Assignment Operators 238
7.12 Increment and Decrement Operators 239
7.13 Web Resources 242
8 JavaScript: Control Statements II 251
8.1 Introduction 252
8.2 Essentials of Counter-Controlled Repetition 252
8.3 for Repetition Statement 253
8.4 Examples Using the for Statement 256
8.5 switch Multiple-Selection Statement 261
8.6 do...while Repetition Statement 264
8.7 break and continue Statements 266
8.8 Logical Operators 268
8.9 Web Resources 271
9 JavaScript: Functions 278
9.1 Introduction 279
9.2 Program Modules in JavaScript 279
9.3 Function Definitions 280
9.3.1 Programmer-Defined Function square 281
9.3.2 Programmer-Defined Function maximum 283
9.4 Notes on Programmer-Defined Functions 285
9.5 Random Number Generation 286
9.5.1 Scaling and Shifting Random Numbers 286
9.5.2 Displaying Random Images 287
9.5.3 Rolling Dice Repeatedly and Displaying Statistics 291
9.6 Example: Game of Chance; Introducing the HTML5 audio and video Elements 296
9.7 Scope Rules 306
9.8 JavaScript Global Functions 308
9.9 Recursion 309
9.10 Recursion vs. Iteration 313
10 JavaScript: Arrays 324
10.1 Introduction 325
10.2 Arrays 325
10.3 Declaring and Allocating Arrays 327
10.4 Examples Using Arrays 327
10.4.1 Creating, Initializing and Growing Arrays 327
10.4.2 Initializing Arrays with Initializer Lists 331
10.4.3 Summing the Elements of an Array with for and for...in 332
10.4.4 Using the Elements of an Array as Counters 334
10.5 Random Image Generator Using Arrays 337
10.6 References and Reference Parameters 339
10.7 Passing Arrays to Functions 340
10.8 Sorting Arrays with Array Method sort 343
10.9 Searching Arrays with Array Method indexOf 344
10.10 Multidimensional Arrays 347
11 JavaScript: Objects 360
11.1 Introduction 361
11.2 Math Object 361
11.3 String Object 363
11.3.1 Fundamentals of Characters and Strings 363
11.3.2 Methods of the String Object 363
11.3.3 Character-Processing Methods 365
11.3.4 Searching Methods 366
11.3.5 Splitting Strings and Obtaining Substrings 369
11.4 Date Object 371
11.5 Boolean and Number Objects 376
11.6 document Object 377
11.7 Favorite Twitter Searches: HTML5 Web Storage 378
11.8 Using JSON to Represent Objects 385
12 Document Object Model (DOM): Objects and Collections 395
12.1 Introduction 396
12.2 Modeling a Document: DOM Nodes and Trees 396
12.3 Traversing and Modifying a DOM Tree 399
12.4 DOM Collections 409
12.5 Dynamic Styles 411
12.6 Using a Timer and Dynamic Styles to Create Animated Effects 413
13 JavaScript Event Handling: A Deeper Look 422
13.1 Introduction 423
13.2 Reviewing the load Event 423
13.3 Event mousemove and the event Object 425
13.4 Rollovers with mouseover and mouseout 429
13.5 Form Processing with focus and blur 433
13.6 More Form Processing with submit and reset 436
13.7 Event Bubbling 438
13.8 More Events 440
13.9 Web Resource 440
14 HTML5: Introduction to canvas 444
14.1 Introduction 445
14.2 canvas Coordinate System 445
14.3 Rectangles 446
14.4 Using Paths to Draw Lines 448
14.5 Drawing Arcs and Circles 450
14.6 Shadows 452
14.7 Quadratic Curves 454
14.8 Bezier Curves 456
14.9 Linear Gradients 457
14.10 Radial Gradients 459
14.11 Images 461
14.12 Image Manipulation: Processing the Individual Pixels of a canvas 463
14.13 Patterns 467
14.14 Transformations 468
14.14.1 scale and translate Methods: Drawing Ellipses 468
14.14.2 rotate Method: Creating an Animation 470
14.14.3 transform Method: Drawing Skewed Rectangles 472
14.15 Text 474
14.16 Resizing the canvas to Fill the Browser Window 476
14.17 Alpha Transparency 477
14.18 Compositing 479
14.19 Cannon Game 482
14.19.1 HTML5 Document 484
14.19.2 Instance Variables and Constants 484
14.19.3 Function setupGame 486
14.19.4 Functions startTimer and stopTimer 487
14.19.5 Function resetElements 487
14.19.6 Function newGame 488
14.19.7 Function updatePositions: Manual Frame-by-Frame Animation and Simple Collision Detection 489
14.19.8 Function fireCannonball 492
14.19.9 Function alignCannon 493
14.19.10 Function draw 494
14.19.11 Function showGameOverDialog 496
14.20 save and restore Methods 496
14.21 A Note on SVG 498
14.22 A Note on canvas 3D 499
15 XML 511
15.1 Introduction 512
15.2 XML Basics 512
15.3 Structuring Data 515
15.4 XML Namespaces 521
15.5 Document Type Definitions (DTDs) 523
15.6 W3C XML Schema Documents 526
15.7 XML Vocabularies 534
15.7.1 MathMLTM 534
15.7.2 Other Markup Languages 537
15.8 Extensible Stylesheet Language and XSL Transformations 538
15.9 Document Object Model (DOM) 547
15.10 Web Resources 565
16 Ajax-Enabled Rich Internet Applications with XML and JSON 571
16.1 Introduction 572
16.1.1 Traditional Web Applications vs. Ajax Applications 573
16.1.2 Traditional Web Applications 573
16.1.3 Ajax Web Applications 574
16.2 Rich Internet Applications (RIAs) with Ajax 574
16.3 History of Ajax 577
16.4 “Raw” Ajax Example Using the XMLHttpRequest Object 577
16.4.1 Asynchronous Requests 578
16.4.2 Exception Handling 581
16.4.3 Callback Functions 582
16.4.4 XMLHttpRequest Object Event, Properties and Methods 582
16.5 Using XML and the DOM 583
16.6 Creating a Full-Scale Ajax-Enabled Application 587
16.6.1 Using JSON 587
16.6.2 Rich Functionality 588
16.6.3 Interacting with a Web Service on the Server 597
16.6.4 Parsing JSON Data 597
16.6.5 Creating HTML5 Elements and Setting Event Handlers on the Fly 598
16.6.6 Implementing Type-Ahead 598
16.6.7 Implementing a Form with Asynchronous Validation 599
17 Web Servers (Apache and IIS) 605
17.1 Introduction 606
17.2 HTTP Transactions 606
17.3 Multitier Application Architecture 610
17.4 Client-Side Scripting versus Server-Side Scripting 611
17.5 Accessing Web Servers 611
17.6 Apache, MySQL and PHP Installation 611
17.6.1 XAMPP Installation 612
17.6.2 Running XAMPP 612
17.6.3 Testing Your Setup 613
17.6.4 Running the Examples Using Apache HTTP Server 613
17.7 Microsoft IIS Express and WebMatrix 614
17.7.1 Installing and Running IIS Express 614
17.7.2 Installing and Running WebMatrix 614
17.7.3 Running the Client-Side Examples Using IIS Express 614
17.7.4 Running the PHP Examples Using IIS Express 615
18 Database: SQL, MySQL, LINQ and Java DB 617
18.1 Introduction 618
18.2 Relational Databases 618
18.3 Relational Database Overview: A books Database 620
18.4SQL 623
18.4.1 Basic SELECT Query 624
18.4.2 WHERE Clause 624
18.4.3 ORDER BY Clause 626
18.4.4 Merging Data from Multiple Tables: INNER JOIN 628
18.4.5 INSERT Statement 629
18.4.6 UPDATE Statement 631
18.4.7 DELETE Statement 631
18.5 MySQL 632
18.5.1 Instructions for Setting Up a MySQL User Account 633
18.5.2 Creating Databases in MySQL 634
18.6 (Optional) Microsoft Language Integrate Query (LINQ) 634
18.6.1 Querying an Array of int Values Using LINQ 635
18.6.2 Querying an Array of Employee Objects Using LINQ 637
18.6.3 Querying a Generic Collection Using LINQ 642
18.7 (Optional) LINQ to SQL 644
18.8 (Optional) Querying a Database with LINQ 645
18.8.1 Creating LINQ to SQL Classes 645
18.8.2 Data Bindings Between Controls and the LINQ to SQL Classes 648
18.9 (Optional) Dynamically Binding LINQ to SQL Query Results 652
18.9.1 Creating the Display Query Results GUI 652
18.9.2 Coding the Display Query Results Application 654
18.10 Java DB/Apache Derby 656
19PHP 664
19.1 Introduction 665
19.2 Simple PHP Program 666
19.3 Converting Between Data Types 667
19.4 Arithmetic Operators 670
19.5 Initializing and Manipulating Arrays 674
19.6 String Comparisons 677
19.7 String Processing with Regular Expressions 678
19.7.1 Searching for Expressions 680
19.7.2 Representing Patterns 680
19.7.3 Finding Matches 681
19.7.4 Character Classes 681
19.7.5 Finding Multiple Instances of a Pattern 682
19.8 Form Processing and Business Logic 682
19.8.1 Superglobal Arrays 682
19.8.2 Using PHP to Process HTML5 Forms 683
19.9 Reading from a Database 687
19.10 Using Cookies 691
19.11 Dynamic Content 694
19.12 Web Resources 702
20 Web App Development with ASP.NET in C# 708
20.1 Introduction 709
20.2 Web Basics 710
20.3 Multitier Application Architecture 711
20.4 Your First ASP.NET Application 713
20.4.1 Building the WebTime Application 715
20.4.2 Examining WebTime.aspx’s Code-Behind File 724
20.5 Standard Web Controls: Designing a Form 724
20.6 Validation Controls 729
20.7 Session Tracking 735
20.7.1Cookies 736
20.7.2 Session Tracking with HttpSessionState 737
20.7.3 Options.aspx: Selecting a Programming Language 740
20.7.4 Recommendations.aspx: Displaying Recommendations Based
on Session Values 743
20.8 Case Study: Database-Driven ASP.NET Guestbook 745
20.8.1 Building a Web Form that Displays Data from a Database 747
20.8.2 Modifying the Code-Behind File for the Guestbook Application 750
20.9 Case Study Introduction: ASP.NET AJAX 752
20.10 Case Study Introduction: Password-Protected Books Database Application 752
21 Web App Development with ASP.NET in C#: A Deeper Look 758
21.1 Introduction 759
21.2 Case Study: Password-Protected Books Database Application 759
21.2.1 Examining the ASP.NET Web Site Template 760
21.2.2 Test-Driving the Completed Application 762
21.2.3 Configuring the Website 764
21.2.4 Modifying the Default.aspx and About.aspx Pages 767
21.2.5 Creating a Content Page That Only Authenticated Users Can Access 768
21.2.6 Linking from the Default.aspx Page to the Books.aspx Page 769
21.2.7 Modifying the Master Page (Site.master) 770
21.2.8 Customizing the Password-Protected Books.aspx Page 772
21.3 ASP.NET Ajax 777
21.3.1 Traditional Web Applications 777
21.3.2 Ajax Web Applications 778
21.3.3 Testing an ASP.NET Ajax Application 779
21.3.4 The ASP.NET Ajax Control Toolkit 780
21.3.5 Using Controls from the Ajax Control Toolkit 781
22 Web Services in C# 789
22.1 Introduction 790
22.2 WCF Services Basics 791
22.3 Simple Object Access Protocol (SOAP) 791
22.4 Representational State Transfer (REST) 792
22.5 JavaScript Object Notation (JSON) 792
22.6 Publishing and Consuming SOAP-Based WCF Web Services 793
22.6.1 Creating a WCF Web Service 793
22.6.2 Code for the WelcomeSOAPXMLService 793
22.6.3 Building a SOAP WCF Web Service 794
22.6.4 Deploying the WelcomeSOAPXMLService 796
22.6.5 Creating a Client to Consume the WelcomeSOAPXMLService 797
22.6.6 Consuming the WelcomeSOAPXMLService 799
22.7 Publishing and Consuming REST-Based XML Web Services 801
22.7.1 HTTP get and post Requests 801
22.7.2 Creating a REST-Based XML WCF Web Service 801
22.7.3 Consuming a REST-Based XML WCF Web Service 804
22.8 Publishing and Consuming REST-Based JSON Web Services 805
22.8.1 Creating a REST-Based JSON WCF Web Service 805
22.8.2 Consuming a REST-Based JSON WCF Web Service 807
22.9 Blackjack Web Service: Using Session Tracking in a SOAP-Based WCF Web Service 809
22.9.1 Creating a Blackjack Web Service 809
22.9.2 Consuming the Blackjack Web Service 814
22.10 Airline Reservation Web Service: Database Access and Invoking a Service from ASP.NET 823
22.11 Equation Generator: Returning User-Defined Types 827
22.11.1 Creating the REST-Based XML EquationGenerator Web Service 830
22.11.2 Consuming the REST-Based XML EquationGenerator Web Service 831
22.11.3 Creating the REST-Based JSON WCF EquationGenerator Web Service 835
22.11.4 Consuming the REST-Based JSON WCF EquationGenerator Web Service 835
22.12 Web Resources 839
23 Web App Development with ASP.NET in Visual Basic 847
23.1 Introduction 848
23.2 Web Basics 849
23.3 Multitier Application Architecture 850
23.4 Your First ASP.NET Application 852
23.4.1 Building the WebTime Application 854
23.4.2 Examining WebTime.aspx’s Code-Behind File 863
23.5 Standard Web Controls: Designing a Form 864
23.6 Validation Controls 869
23.7 Session Tracking 875
23.7.1Cookies 876
23.7.2 Session Tracking with HttpSessionState 877
23.7.3 Options.aspx: Selecting a Programming Language 879
23.7.4 Recommendations.aspx: Displaying Recommendations Based on Session Values 883
23.8 Case Study: Database-Driven ASP.NET Guestbook 885
23.8.1 Building a Web Form that Displays Data from a Database 887
23.8.2 Modifying the Code-Behind File for the Guestbook Application 891
23.9 Online Case Study: ASP.NET AJAX 892
23.10 Online Case Study: Password-Protected Books Database Application 892
A HTML Special Characters 898
B HTML Colors 899
C JavaScript Operator Precedence Chart 902
D ASCII Character Set 904
Index 905
Chapters 24–29 and Appendices E–F are PDF documents posted online at the book’s Companion Website (located at www.pearsonhighered.com/deitel/).
24 Web App Development with ASP.NET in VB: A Deeper Look
25 Web Services in Visual Basic
26 JavaServerTM Faces Web Apps: Part 1
27 JavaServerTM Faces Web Apps: Part 2
28 Web Services in Java
29 HTML5 WebSockets and Web Workers
E Number Systems
F Unicode®