Training Guide: Programming In HTML5 With JavaScript And CSS3 Ebook Java Script CSS3.Training Guide 2013

Programming%20in%20HTML5%20with%20JavaScript%20and%20CSS3.Training%20Guide%20-%202013

Programming%20in%20HTML5%20with%20JavaScript%20and%20CSS3.Training%20Guide%20-%202013

Programming%20in%20HTML5%20with%20JavaScript%20and%20CSS3.Training%20Guide%20-%202013

Programming%20in%20HTML5%20with%20JavaScript%20and%20CSS3.Training%20Guide%20-%202013

Programming%20in%20HTML5%20with%20JavaScript%20and%20CSS3.Training%20Guide%20-%202013

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 681

DownloadTraining Guide: Programming In HTML5 With JavaScript And CSS3 Ebook Java Script CSS3.Training Guide - 2013
Open PDF In BrowserView PDF
spine = 1.28”

Designed to help enterprise administrators develop real-world,
job-role-specific skills—this Training Guide focuses on deploying
and managing core infrastructure services in Windows Server 2012.
Build hands-on expertise through a series of lessons, exercises,
and suggested practices—and help maximize your performance
on the job.

This Microsoft Training Guide:
• Provides in-depth, hands-on training you take at your own pace
• Focuses on job-role-specific expertise for deploying and
•

managing Windows Server 2012 core services

Creates a foundation of skills which, along with on-the-job
experience, can be measured by Microsoft Certification exams
such as 70-410

Sharpen your skills. Increase your expertise.
• Plan a migration to Windows Server 2012
• Deploy servers and domain controllers
• Administer Active Directory and enable advanced features
• Ensure DHCP availability and implement DNSSEC
• Perform network administration
• Deploy and manage Hyper-V hosts and virtual machines
• Deploy and manage Storage Spaces and iSCSI storage
• Deploy and manage print servers
• Plan, configure, and manage Group Policy
• Automate administrative tasks with Windows PowerShell™
®

®

About You

This Training Guide will be most useful
to IT professionals who have at least
three years of experience administering
previous versions of Windows Server in
midsize to large environments.

About the Author

Mitch Tulloch is a widely recognized
expert on Windows administration and
has been awarded Microsoft® MVP
status for his contributions supporting
those who deploy and use Microsoft
platforms, products, and solutions. He
is the author of Introducing Windows
Server 2012 and the upcoming
Windows Server 2012 Virtualization
Inside Out.

About the Practices

For most practices, we recommend
using a Hyper-V virtualized
environment. Some practices will
require physical servers.
For system requirements, see the
Introduction.

Preparing for
Microsoft Certification?
Get the official exam-prep guide
for Exam 70-410.

Exam Ref 70-410: Installing and
Configuring Windows Server 2012
ISBN 9780735673168

90000

000000 000000

Training
Guide

U.S.A. $39.99
Canada $41.99
[Recommended]

0

Programming
in HTML5 with
JavaScript and
CSS3

Glenn Johnson

microsoft.com/mspress
ISBN: 978-0-7356-xxxx-x

Programming in HTML5 with
JavaScript and CSS3

Programming in HTML5 with
JavaScript and CSS3

Certification/
Windows Server

Glenn Johnson

PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2013 by Glenn Johnson
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any
means without the written permission of the publisher.
Library of Congress Control Number: 2013933428
ISBN: 978-0-7356-7438-7
Printed and bound in the United States of America.
Second Printing
Microsoft Press books are available through booksellers and distributors worldwide. If you need support related
to this book, email Microsoft Press Book Support at mspinput@microsoft.com. Please tell us what you think of
this book at http://www.microsoft.com/learning/booksurvey.
Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty
/Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of
their respective owners.
The example companies, organizations, products, domain names, email addresses, logos, people, places, and
events depicted herein are fictitious. No association with any real company, organization, product, domain name,
email address, logo, person, place, or event is intended or should be inferred.
This book expresses the author’s views and opinions. The information contained in this book is provided without
any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or
distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by
this book.
Acquisitions Editor: Devon Musgrave
Developmental Editor: Devon Musgrave
Project Editor: Carol Dillingham
Editorial Production: nSight, Inc.
Technical Reviewer: Pierce Bizzaca; Technical Review services provided by Content Master, a member of
CM Group, Ltd.
Copyeditor: Kerin Forsyth
Indexer: Lucie Haskins
Cover: Twist Creative • Seattle

[2013-08-09]

Contents at a glance
Introduction
CHAPTER 1

Getting started with Visual Studio 2012 and Blend
for Visual Studio 2012

xxi
1

CHAPTER 2

Getting started with HTML5

29

CHAPTER 3

Getting started with JavaScript

65

CHAPTER 4

Getting started with CSS3

137

CHAPTER 5

More HTML5

205

CHAPTER 6

Essential JavaScript and jQuery

261

CHAPTER 7

Working with forms

311

CHAPTER 8

Websites and services

341

CHAPTER 9

Asynchronous operations

393

CHAPTER 10

WebSocket communications

415

CHAPTER 11

HTML5 supports multimedia

437

CHAPTER 12

Drawing with HTML5

459

CHAPTER 13

Drag and drop

507

CHAPTER 14

Making your HTML location-aware

539

CHAPTER 15

Local data with web storage

555

CHAPTER 16

Offline web applications

581

Index

621

Contents
Introduction

Chapter 1

xix

Backward compatibility and cross-browser compatibility

xx

System requirements

xx

Practice exercises

xxi

Acknowledgments

xxi

Errata and book support

xxi

We want to hear from you

xxii

Stay in touch

xxii

Getting started with Visual Studio 2012 and Blend
for Visual Studio 2012

4

Lesson 1: Visual Studio 2012. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
Visual Studio 2012 editions

5

Visual Studio 2012 support for HTML5

6

CSS3 support

7

JavaScript support

7

Exploring Visual Studio Express 2012 for Windows 8

8

Exploring Visual Studio Express 2012 for Web

12

Lesson summary

14

Lesson review

15

Lesson 2: Blend for Visual Studio 2012. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  16
Exploring Blend

16

Lesson summary

22

Lesson review

23

Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  23

What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our
books and learning resources for you. To participate in a brief online survey, please visit:

www.microsoft.com/learning/booksurvey/
v

Exercise 1: Hello World with Visual Studio Express 2012
for Windows 8

24

Exercise 2: Hello World with Visual Studio Express 2012
for Web

25

Exercise 3: Hello World with Blend

27

Suggested practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  28
Answers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  29

Chapter 2

Getting started with HTML5

32

Lesson 1: Introducing HTML5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  32
Understanding HTML, XHTML, and HTML5

33

Introducing semantic markup

34

Working with elements

35

Creating an HTML document

43

Lesson summary

45

Lesson review

46

Lesson 2: Embedding content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  47
Embedding HTML by using inline frames

47

Working with hyperlinks

49

Adding images to your HTML document

50

Embedding plug-in content

53

Lesson summary

55

Lesson review

56

Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  56
Exercise 1: Create a simple website by using Visual Studio
Express for Web

56

Exercise 2: Create additional pages

59

Exercise 3: Embedding Content

61

Suggested practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  64
Answers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  65

Chapter 3

Getting started with JavaScript

65

Lesson 1: Introducing JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  66
Understanding JavaScript
vi

Contents

66

Understanding the role of data

67

Using statements

71

Working with functions

73

Scoping variables

77

Nesting functions and nested local variable scoping

78

Converting to a different type

78

Conditional programming

80

Implementing code loops

84

Handling errors

87

Lesson summary

88

Lesson review

88

Lesson 2: Writing, testing, and debugging JavaScript. . . . . . . . . . . . . . . . .  89
Hello World from JavaScript

90

Using the script tag

100

Handling browsers that don’t support JavaScript

101

Inline JavaScript vs. external JavaScript files

102

Placing your script elements

102

Using the Visual Studio .NET JavaScript debugger

103

Lesson summary

107

Lesson review

107

Lesson 3: Working with objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  108
Working with arrays

108

Accessing DOM objects

112

Lesson summary

120

Lesson review

121

Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  121
Exercise 1: Create a calculator webpage

121

Exercise 2: Add the QUnit testing framework

123

Suggested practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  133
Answers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  134

Chapter 4

Getting started with CSS3

137

Lesson 1: Introducing CSS3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  137
Defining and applying a style

139
Contents

vii

Adding comments within a style sheet

139

Creating an inline style

140

Creating an embedded style

140

Creating an external style sheet

141

Lesson summary

144

Lesson review

145

Lesson 2: Understanding selectors, specificity, and cascading. . . . . . . . .  145
Defining selectors

146

Understanding the browser’s built-in styles

159

Extending browser styles with user styles

159

Working with important styles

159

How do styles cascade?

160

Using specificity

161

Understanding inheritance

162

Lesson summary

163

Lesson review

164

Lesson 3: Working with CSS properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  165
Working with CSS colors

166

Working with text

173

Working with the CSS box model

175

Setting the border, padding, and margin properties

176

Positioning 
elements 178 Using the float property 186 Using the clear property 189 Using the box-sizing property 190 Centering content in the browser window 193 Lesson summary 193 Lesson review 194 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Exercise 1: Add a style sheet to the calculator project 195 Exercise 2: Clean up the web calculator 197 Suggested practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Answers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 viii Contents Chapter 5 More HTML5 205 Lesson 1: Thinking HTML5 semantics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Why semantic markup? 206 Browser support for HTML5 206 Creating semantic HTML5 documents 207 Creating an HTML5 layout container 207 Controlling format by using the
element 213 Adding thematic breaks 213 Annotating content 213 Working with lists 221 Lesson summary 228 Lesson review 229 Lesson 2: Working with tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Table misuse 230 Creating a basic table 230 Adding header cells 231 Styling the table headers 232 Declaring the header, footer, and table body 233 Creating irregular tables 238 Adding a caption to a table 241 Styling columns 241 Lesson summary 242 Lesson review 243 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Exercise 1: Add a page layout to the calculator project 244 Exercise 2: Add styles to the calculator layout 246 Exercise 3: Cleaning up the web calculator 252 Suggested practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Answers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Chapter 6 Essential JavaScript and jQuery 261 Lesson 1: Creating JavaScript objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Using object-oriented terminology 262 Contents ix Understanding the JavaScript object-oriented caveat 263 Using the JavaScript object literal pattern 263 Creating dynamic objects by using the factory pattern 265 Creating a class 266 Using the prototype property 271 Debating the prototype/private compromise 274 Implementing namespaces 276 Implementing inheritance 278 Lesson summary 283 Lesson review 284 Lesson 2: Working with jQuery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Introducing jQuery 285 Getting started with jQuery 286 Using jQuery 287 Enabling JavaScript and jQuery IntelliSense 291 Creating a jQuery wrapper for a DOM element reference 294 Adding event listeners 295 Triggering event handlers 295 Initializing code when the browser is ready 295 Lesson summary 296 Lesson review 296 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Exercise 1: Create a calculator object 297 Suggested practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Answers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 Chapter 7 Working with forms 311 Lesson 1: Understanding forms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 x Contents Understanding web communications 312 Submitting form data to the web server 316 Sending data when submitting a form 316 Using the