Tuesday, November 29, 2011

An Introduction to HTML and Java Script for Scientists and Engineers






Contents





1. Introductory Concepts ............................................................................. 1
1.1 Introducing the Tools ...................................................................... 1
1.1.1 What Is an HTML Document?.............................................. 1
1.1.2 What Is Jav aScript?............................................................... 3
1.1.3 How Do You Create HTML/Ja vaScript Documents? 4
1.1.4 Some Typographic Conventions Used in This Book 7
1.1.5 Where Should I Look for More Information
about HTML and Jav aScript? .............................................. 7
1.2 Your First HTML/Jav aScript Documents ....................................... 8
1.3 Accessing HTML Documents on the Web.................................... 16
1.4 Another Example .......................................................................... 18

2. HTML Document Basics......................................................................... 21
2.1 Documents, Elements, Attributes, and Values .............................. 21
2.1.1 Essential Elements .............................................................. 21
2.1.2 Some Other Imp ortant Elements......................................... 22
2.2 HTML Syntax and Style ............................................................... 29
2.3 Using the script Element ........................................................... 30
2.4 Creating and Organizing a Web Site............................................. 31
2.5 Selecting and Using Colors........................................................... 35
2.6 Using Cascading Style Sheets ....................................................... 36
2.7 Another Example .......................................................................... 42

3. HTML Tables, Forms, and Lists .............................................................. 43
3.1 The table Element ...................................................................... 43
3.1.1 Basic Table Formatting....................................................... 43
3.1.2 Merging Cells across Rows and Columns............................ 45
3.2 The form Element......................................................................... 49
3.3 Creating Pull-Down Lists.............................................................. 53
3.4 Combining Tables and Forms ....................................................... 54
3.5 E-Mailing the Contents of Forms.................................................. 57
3.6 The List Elements ......................................................................... 59
3.7 Another Example .......................................................................... 64
4. Fundamentals of the Jav aScript Language.................................................... 67
4.1 Capabilities of Jav aScript.............................................................. 67
4.2 Some Essential Terminology ........................................................ 69
4.3 Structure of Jav aScript Code......................................................... 70
4.3.1 Jav aScript Statements ......................................................... 70
4.3.2 Statement Blocks ................................................................ 71
4.3.3 Comments ........................................................................... 71
4.4 Data and Objects ........................................................................... 73
4.4.1 Data Declarations and Variables......................................... 73
4.4.2 Data Types .......................................................................... 74
4.4.3 Literals ................................................................................ 75
4.4.4 Case Sensitivity................................................................... 75
4.4.5 Objects and Methods for Input and Output......................... 76
4.4.6 String Methods.................................................................... 78
4.5 Tokens, Operators, Expressions, and Statements.......................... 80
4.5.1 Tokens................................................................................. 80
4.5.2 Arithmetic Operators .......................................................... 81
4.5.3 The Assignment Operator ................................................... 82
4.5.4 Shorthand Arithmetic/Assignment Operators..................... 83
4.6 The Jav aScript Math Object.......................................................... 85
4.7 Comparison Operators and Decision-Making Structures.............. 90
4.7.1 Relational and Logical Operators ....................................... 90
4.7.2 The if Construct (Branching Structures) ........................... 90
4.7.3 The switch Construct........................................................ 95
4.8 Loop Structures ............................................................................. 97
4.8.1 Count-Controlled Loops ..................................................... 97
4.8.2 Conditional Loops............................................................... 99
4.9 Using Jav aScript to Change Values in Form Fields.................... 102
4.10 Another Example......................................................................... 105

5. Using Arrays in HTML/Ja vaScript ........................................................107
5.1 Basic Array Properties ................................................................ 107
5.2 Some Operations on Arrays ........................................................ 111
5.2.1 Manipulating Stacks and Queues...................................... 111
5.2.2 Sorting............................................................................... 114
5.3 Creating Two-Dimensional Arrays ............................................. 115
5.4 Using Arrays to Access the Contents of Forms .......................... 118
5.4.1 Accessing Values of type= text Fields ...................... 118
5.4.2 Accessing type= radio and type= checkbox
Fields................................................................................. 120
5.5 Hiding the Contents of a Jav aScript Script ................................. 122
5.6 Another Example ........................................................................ 124
6. Jav aScript Functions............................................................................. 127
6.1 The Purpose of Functions in Programming................................. 127
6.2 Defining Ja vaScript Functions .................................................... 128
6.3 Using Ja vaScript Functions with HTML Forms ......................... 131
6.3.1 Using Numerical Values as Input ..................................... 132
6.3.2 Using Field Name value Attributes as Input................... 135
6.3.3 Using Field Names as Input.............................................. 135
6.3.4 Using Entire Forms as Input ............................................. 136
6.4 Some Global Methods and Event Handlers .............................. 140
6.4.1 Global Methods .............................................................. 140
6.4.2 Using Event Handlers with Forms and Functions ............ 143
6.5 Recursive Functions .................................................................... 144
6.6 Passing Values from One Document to Another ........................ 149
6.7 Revisiting the Jav aScript sort() Method ................................. 151
6.8 More Examples ........................................................................... 152

Glossary ...............................................................................................

Appendices .............................................................................................169
A.1 HTML Document Examples ...................................................... 169
A.2 Displaying Special Characters in an HTML Document ............. 171

Exercises...............................................................................................173

Index ....................................................................................................193
161

Another Internet Books
Another Web Programming Books
Download

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!