Shweta Bhasin - Making Use of JavaScript.pdf
(
7106 KB
)
Pobierz
Making Use of JavaScript
Making Use of JavaScript
Table of Contents
Making Use of JavaScript.................................................................................................................1
Introduction........................................................................................................................................3
Overview of JavaScript............................................................................................................3
Technologies Before JavaScript........................................................................................3
History of JavaScript................................................................................................................4
JavaScript Myth.......................................................................................................................4
JavaScript and Java...........................................................................................................4
Features of JavaScript.............................................................................................................5
How This Book Is Organized...................................................................................................5
Who Should Read this Book....................................................................................................7
Tools You Will Need................................................................................................................7
Installations..............................................................................................................................8
What’s on the Web Site...........................................................................................................8
Scenario..............................................................................................................................................9
Web Shoppe: Online Shopping Mall........................................................................................9
Site Architecture.................................................................................................................9
User Interface of the Site.................................................................................................10
Future Plans.....................................................................................................................10
Chapter 1: Introducing Web Development....................................................................................12
Getting Started.......................................................................................................................12
What Is the Internet?..............................................................................................................12
How Did the Internet Evolve?................................................................................................12
How Does the Internet Operate?...........................................................................................13
Client................................................................................................................................13
Serve...............................................................................................................................13
The Client/Server Network...............................................................................................14
Mode of Data Transmission.............................................................................................14
Who Administers the Internet?...............................................................................................15
How Can I Connect to the Internet?.......................................................................................15
Dial−up Connection..........................................................................................................16
Leased Lines....................................................................................................................16
Components of the Internet...................................................................................................17
World Wide Web..............................................................................................................17
Web Page........................................................................................................................18
HyperText Markup Language...........................................................................................18
Web Browse....................................................................................................................18
Uniform Resource Locator (URL.....................................................................................19
HyperText Transfer Protocol............................................................................................19
Summary................................................................................................................................22
Chapter 2: Overview of JavaScript................................................................................................23
Getting Started.......................................................................................................................23
Types of JavaScripts........................................................................................................23
Creating a Simple JavaScrip.................................................................................................25
Identify the Mechanism to Incorporate the Functionality of Viewing the Prices of
Toys in U.S. as well as Canadian Dollars.................................................................27
Write the Code for Displaying the Message that the Page Is Still under Construction....27
i
Table of Contents
Chapter 2: Overview of JavaScript
Execute and Verify the Code...........................................................................................40
Summary................................................................................................................................40
Chapter 3: JavaScript Data Types, Variables, and Operators.....................................................41
Getting Started.......................................................................................................................41
Identify the Variables, Data Types, and Operators to Be Used.......................................42
Write the Code to Accept and Display the Details...........................................................65
Execute the Code.............................................................................................................66
Summary................................................................................................................................67
Chapter 4: JavaScript Control Structures and Statements.........................................................68
Getting Started.......................................................................................................................68
Using Programming Statements............................................................................................68
Identify the Conditional and Looping Statements to be Used..........................................69
Write the code..................................................................................................................85
Execute and Verify the Code...........................................................................................87
Summary................................................................................................................................88
Chapter 5: Functions and Events...................................................................................................89
Getting Started.......................................................................................................................89
Identify the Data that Needs to Be Accepted...................................................................90
Design the User−Interface Screen to Accept Data..........................................................90
Identify Functions and Events to Ensure the Entry of the Username and the
Password..................................................................................................................91
Write the Code for the Web Page..................................................................................109
Execute and Verify the Code.........................................................................................110
Summary..............................................................................................................................111
Chapter 6: Using Objects in JavaScript......................................................................................112
Getting Started.....................................................................................................................112
About Objects......................................................................................................................112
Revisiting Object−Oriented Programming......................................................................112
Difference between Object−Oriented and Object−Based Programming........................114
JavaScript Object Model......................................................................................................114
Accessing Properties.....................................................................................................114
Accessing Methods........................................................................................................116
Creating Instances of Objects..............................................................................................116
Overview of the Object Hierarchy Model.............................................................................117
The window Objec.........................................................................................................117
The navigator Objec......................................................................................................118
Predefined Object Types.....................................................................................................118
The Array Object............................................................................................................118
The Boolean Object.......................................................................................................119
The String Object...........................................................................................................120
The Date Object.............................................................................................................122
The Global Object..........................................................................................................125
The Math Objec.............................................................................................................126
The Number Objec........................................................................................................127
The Object object...........................................................................................................128
ii
Table of Contents
Chapter 6: Using Objects in JavaScript
Identify Necessary Objects............................................................................................129
Create Object Instances.................................................................................................129
Write the Code to Include the Required Functionality....................................................129
Execute and Verify the Code.........................................................................................130
Custom Object Types..........................................................................................................131
Defining Properties of an Object....................................................................................131
Adding Methods to Objects............................................................................................132
Updating Objects Dynamically.......................................................................................132
Working with a Custom Object Type..............................................................................133
Deleting Properties and Methods...................................................................................134
Identify the Customer Data that Needs to Be Accepted.................................................135
Design the User Interface Screen to Accept the Data...................................................135
Identify the Objects and Methods to Display and Validate the Customer Data..............135
Write the Code for the Web Page..................................................................................135
Execute and Verify the Code.........................................................................................136
Summary..............................................................................................................................137
Chapter 7: Error and Exception Handling in JavaScript............................................................138
Getting Started.....................................................................................................................138
Identify the Errors in the Preceding Code......................................................................140
Identify the Mechanism for Trapping Errors...................................................................140
Write the Code for Exception−Handling.........................................................................154
Execute the code...........................................................................................................156
Summary..............................................................................................................................156
Chapter 8: Working with Browser Objects..................................................................................158
Getting Started.....................................................................................................................158
Browser Hierarchy Mode.....................................................................................................158
Creating Documents at Run Time........................................................................................159
Identify Data for Bill Details............................................................................................162
Identify the Events Required..........................................................................................162
Identify a Mechanism (Objects) to Display Bill Details...................................................162
Write a Script for the Creation of the Bill........................................................................177
Execute and Verify the Page..........................................................................................179
Retrieving Values from a Form by Using a form Objec.......................................................183
Identify the Components of User Interface.....................................................................184
Identify the HTML Form Elements for the User Interface...............................................184
Identify the Objects to Retrieve Data from the Form......................................................185
Write the Code to Create the Customer Details Form and to Retrieve Values from
the Form..................................................................................................................197
Execute the code...........................................................................................................200
Using Frames with JavaScript to Display Several Pages in a Window................................202
Identify the Frames Required to Incorporate the Preceding Functionality.....................203
Write the Code...............................................................................................................209
Execute and Verify the Code.........................................................................................212
Summary..............................................................................................................................214
iii
Table of Contents
Chapter 9: Creating Cookies in JavaScript.................................................................................215
Getting Started.....................................................................................................................215
Creating Cookies.................................................................................................................215
Identify the Objects and Properties of JavaScript to Add Personalized Message
and Hit Count to the Site.........................................................................................216
Write the Code...............................................................................................................225
Execute and Verify the Successful Running of the Code...............................................228
Summary..............................................................................................................................229
Chapter 10: JavaScript and Plug−ins..........................................................................................230
Getting Started.....................................................................................................................230
Using Plug−ins.....................................................................................................................230
Identify the Objects that Are Used to Work with Plug−Ins by Using JavaScrip.............230
Write the Code...............................................................................................................245
Execute and Verify the Code.........................................................................................246
Summary..............................................................................................................................246
Chapter 11: Styles and Layers.....................................................................................................247
Getting Started.....................................................................................................................247
Introducing DHTML........................................................................................................247
Using Styles and Layers......................................................................................................248
Identify the Methods to Use Styles and Implement DHTML features with JavaScript...249
Creating Animation Effects.............................................................................................268
Creating Multimedia Effects...........................................................................................270
Write the Code...............................................................................................................273
Execute and Verify the Code.........................................................................................283
Summary..............................................................................................................................284
Chapter 12: Server−Side JavaScript Using Active Server Pages.............................................285
Getting Started.....................................................................................................................285
Active Server Pages............................................................................................................285
Creating an ASP Application................................................................................................287
Identify the ASP Objects to Add the Personalized Message and the Hit Count in the
Home Page.............................................................................................................288
Write the Code for the HTML Page that will Accept the Customer’s Name and Take
the Customer to the Home Page.............................................................................304
Write the ASP Code for the Home Page that will Display the Personalized Message
and the Hit Count....................................................................................................304
Execute and Verify the Successful Running of the Code...............................................305
Creating Database Connectivity Using Active Server Pages...............................................307
Identify a Mechanism to Store Customer Information and Provide Customer ID and
Password................................................................................................................307
Write the code................................................................................................................322
Execute and Verify the Successful Running of the Code...............................................324
Summary..............................................................................................................................325
Appendix A: Using LiveWire for Server−Side Database Connectivity.....................................326
Client/Server Architecture....................................................................................................326
Server−Side Scripting and JavaScript.................................................................................328
Using LiveWire for Server−Side Scripting............................................................................329
iv
Plik z chomika:
shadowgroup
Inne pliki z tego folderu:
Java Script - Cwiczenia praktyczne.rar
(1387 KB)
Thomas Powell, Fritz Schneider - JavaScript 2.0 The Complete Reference, 2nd Edition.chm
(12244 KB)
Shweta Bhasin - Making Use of JavaScript.pdf
(7106 KB)
JavaScript Helion.rar
(3328 KB)
JavaScript Helion Java Server Pages.rar
(2917 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
Pliki dostępne do 08.07.2024
Pliki dostępne do 19.01.2025
Angielski
anja i simone
Zgłoś jeśli
naruszono regulamin