مشخصات کتاب
-
David R. Brooks
-
2011
-
انگلیسی
-
7341
-
589
-
2
Guide to HTML, JavaScript and PHP
1 Introducing HTML and JavaScript................................................................. 1
1.1 Introducing the Tools.................................................................................. 1
1.1.1 What Is an HTML Document?....................................................... 1
1.1.2 What Is JavaScript?........................................................................ 3
1.1.3 How Do You Create HTML/JavaScript Documents?..................... 4
1.1.4 Some Typographic Conventions Used in This Book...................... 6
1.1.5 Where Can You Find More Information About HTML
and JavaScript?............................................................................... 6
1.2 Your First HTML/JavaScript Documents................................................... 7
1.3 Accessing HTML Documents on the Web................................................. 14
1.4 Another Example........................................................................................ 16
2 HTML Document Basics................................................................................... 19
2.1 Documents, Elements, Attributes, and Values............................................ 19
2.1.1 Essential Elements.......................................................................... 19
2.1.2 Some Other Important Elements.................................................... 20
2.2 HTML Syntax and Style............................................................................. 26
2.3 Using the script Element....................................................................... 28
2.4 Creating and Organizing a Web Site........................................................... 28
2.5 Selecting and Using Colors......................................................................... 32
2.6 Using Cascading Style Sheets..................................................................... 34
2.7 Another Example........................................................................................ 39
3 HTML Tables, Forms, Lists, and Frames........................................................ 41
3.1 The table Element................................................................................... 41
3.1.1 Basic Table Formatting................................................................... 41
3.1.2 Subdividing Tables into Sections.................................................... 43
3.1.3 Merging Cells Across Rows and Columns..................................... 45
3.2 The form and input Elements................................................................ 48
3.3 Creating Pull-Down Lists........................................................................... 52
3.4 Combining Tables and Forms..................................................................... 53
3.5 E-Mailing the Contents of Forms............................................................... 55
3.6 The List Elements....................................................................................... 57
3.7 Using HTML Frames................................................................................ 62
3.8 More Examples......................................................................................... 67
3.8.1 Selecting Cloud Types from a List of Possibilities..................... 67
3.8.2 A Simple “Split Window” Application....................................... 69
4 Fundamentals of the JavaScript Language..................................................... 73
4.1 Capabilities of JavaScript.......................................................................... 73
4.2 Some Essential Terminology..................................................................... 74
4.3 Structure of JavaScript Code..................................................................... 76
4.3.1 JavaScript Statements.................................................................. 76
4.3.2 Statement Blocks......................................................................... 76
4.3.3 Comments.................................................................................... 77
4.4 Data and Objects....................................................................................... 78
4.4.1 Data Declarations and Variables................................................. 78
4.4.2 Data Types................................................................................... 79
4.4.3 Literals......................................................................................... 80
4.4.4 Case Sensitivity........................................................................... 80
4.4.5 Objects and Methods for Input and Output................................. 81
4.4.6 String Methods............................................................................ 83
4.5 Tokens, Operators, Expressions, and Statements...................................... 85
4.5.1 Tokens......................................................................................... 85
4.5.2 Arithmetic Operators................................................................... 85
4.5.3 The Assignment Operator........................................................... 86
4.5.4 Shorthand Arithmetic/Assignment Operators............................. 87
4.6 The JavaScript Math Object..................................................................... 89
4.7 Comparison Operators and Decision-Making Structures......................... 93
4.7.1 Relational and Logical Operators................................................ 93
4.7.2 The if Construct (Branching Structures)................................... 93
4.7.3 The switch Construct............................................................... 98
4.8 Loop Structures......................................................................................... 99
4.8.1 Count-Controlled Loops.............................................................. 99
4.8.2 Conditional Loops....................................................................... 101
4.9 Using JavaScript to Change Values in Form Fields.................................. 104
4.10 More Examples......................................................................................... 107
4.10.1 Solving the Quadratic Equation.................................................. 107
4.10.2 Rectangular Rule Numerical Integration..................................... 108
5 Using Arrays in HTML/JavaScript.................................................................. 111
5.1 Basic Array Properties.............................................................................. 111
5.2 Some Operations on Arrays...................................................................... 115
5.2.1 Manipulating Stacks and Queues................................................ 115
5.2.2 Sorting......................................................................................... 117
5.3 More about Array Methods....................................................................... 118
5.4 Creating Two-Dimensional Arrays........................................................... 119
5.5 Using Arrays to Access the Contents of Forms........................................ 122
5.5.1 Accessing values of type="text" Fields.................................. 122
5.5.2 Accessing type="radio" and type="checkbox"
Fields............................................................................................... 125
5.5.3 Accessing Multiple Options Chosen in <select> tags............... 127
5.6 Hiding the Contents of a JavaScript Script................................................. 129
5.7 More Examples........................................................................................... 131
5.7.1 Checking IDs and Passwords.......................................................... 131
5.7.2 Magic Squares................................................................................ 132
6 JavaScript Functions......................................................................................... 135
6.1 The Purpose of Functions in Programming................................................ 135
6.2 Defining JavaScript Functions.................................................................... 136
6.3 Using JavaScript Functions With HTML Forms........................................ 138
6.3.1 Passing Numerical Values to a Function........................................ 139
6.3.2 Using Entire Forms as Input........................................................... 142
6.3.3 Using Arrays to Return Output Values........................................... 145
6.4 Some Global Methods and Event Handlers................................................ 146
6.4.1 Global Methods.............................................................................. 146
6.4.2 Using Event Handlers with Forms and Functions.......................... 149
6.5 Recursive Functions.................................................................................... 150
6.6 Passing Values from One Document to Another........................................ 154
6.7 Revisiting the JavaScript sort() Methods.............................................. 157
6.8 More Examples........................................................................................... 158
6.8.1 Dewpoint Temperature................................................................... 158
6.8.2 Loan Repayment Schedule............................................................. 160
6.8.3 Legendre Polynomials.................................................................... 162
6.8.4 Array-Derived Pull-Down Menus.................................................. 163
6.8.5 Creating a “Password-Protected” HTML Document..................... 165
7 Creating a Server-Side Environment with PHP............................................. 167
7.1 Getting Started with PHP............................................................................ 167
7.2 More Examples........................................................................................... 182
7.2.1 Solving the Quadratic Equation...................................................... 182
7.2.2 Preventing Multiple Submissions from a Form.............................. 184
8 Working with PHP............................................................................................. 187
8.1 Structure of PHP Scripts............................................................................. 187
8.1 Calculations with PHP................................................................................ 188
8.3 More About PHP File Input/Output............................................................ 203
8.4 More Examples........................................................................................... 206
8.4.1 Calculating Volumes of Solid Objects............................................ 206
8.4.2 Processing .bmp Image Files......................................................... 211
8.4.3 Transforming and Displaying Images............................................. 221
8.4.4 Self-Contained HTML/JavaScript/PHP Documents...................... 222
9 PHP Arrays......................................................................................................... 225
9.1 Array Definition........................................................................................ 225
9.2 Array Sorting............................................................................................. 229
9.3 Stacks, Queues, and Line Crashers........................................................... 232
9.4 More Examples......................................................................................... 234
9.4.1 The Quadratic Formula Revisited............................................... 234
9.4.2 Reading checkbox Values........................................................ 237
9.4.3 Building a Histogram Array........................................................ 241
9.4.4 Shuffle a Card Deck.................................................................... 243
9.4.5 Manage a Data File..................................................................... 244
9.4.6 Recursive Insertion Sort.............................................................. 249
10 Summary of Selected PHP Language Elements.............................................. 251
10.1 Data Types and Operators......................................................................... 251
10.1.1 Data Types................................................................................... 251
10.1.2 Operators..................................................................................... 252
10.2 Conditional Execution............................................................................... 253
10.2.1 Conditional Execution................................................................. 253
10.2.2 Case-Controlled Conditional Execution...................................... 254
10.3 Loops......................................................................................................... 255
10.3.1 Count-Controlled Loops.............................................................. 256
10.3.2 Condition-Controlled Loops....................................................... 258
10.4 Functions and Language Constructs......................................................... 259
10.4.1 File Handling and I/O Functions................................................. 259
10.4.2 String Handling Functions.......................................................... 269
10.4.3 Math Constants and Functions.................................................... 273
10.4.4 Array Functions and Language Constructs................................. 275
10.4.5 Miscellaneous Functions and Constructs.................................... 281
11 Using PHP from a Command Line................................................................... 287
12 Using Graphics with PHP................................................................................. 293
12.1 Introduction............................................................................................... 293
12.2 Writing GD Graphics Applications for Displaying Data.......................... 293
12.2.1 Getting Started............................................................................. 295
12.2.2 Pie Charts.................................................................................... 297
12.2.3 Horizontal Bar Charts.................................................................. 306
12.2.4 Vertical Bar Charts...................................................................... 316
12.2.5 Line Graphs................................................................................. 330
12.3 Summary of Some GD Graphics Functions.............................................. 344
12.3.1 Create and Destroy Images......................................................... 344
12.3.2 Draw Lines and Shapes............................................................... 345
12.3.3 Display Text................................................................................ 347
Appendices.................................................................................................................. 349
A.1 List of Document Examples.............................................................................. 349
A.2 Displaying Special Characters in an HTML Document.................................... 353
A.3 ASCII Character Codes..................................................................................... 355
A.4 Strategies for Solving Computational Problems................................................ 357
Exercises..................................................................................................................... 365
Glossary...................................................................................................................... 395
Index........................................................................................................................... 403
Output Examples in Color........................................................................................ 413
HTML and XHTML Packet Reference
نویسنده: Jennifer Niederst Robbins
زبان: انگلیسی