0% found this document useful (0 votes)
10 views

Practical JavaScript DOM Scripting and Ajax Projects 1st Edition Frank Zammetti download

The document provides links to various ebooks and textbooks related to JavaScript, DOM scripting, and Ajax, including titles by authors such as Frank Zammetti and Jeremy Keith. It highlights the availability of these resources for download at ebookultra.com. Additionally, it includes a brief overview of the contents and structure of the book 'Practical JavaScript DOM Scripting and Ajax Projects' by Frank Zammetti.

Uploaded by

kakiodewane
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Practical JavaScript DOM Scripting and Ajax Projects 1st Edition Frank Zammetti download

The document provides links to various ebooks and textbooks related to JavaScript, DOM scripting, and Ajax, including titles by authors such as Frank Zammetti and Jeremy Keith. It highlights the availability of these resources for download at ebookultra.com. Additionally, it includes a brief overview of the contents and structure of the book 'Practical JavaScript DOM Scripting and Ajax Projects' by Frank Zammetti.

Uploaded by

kakiodewane
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Download the full version and explore a variety of ebooks

or textbooks at https://ebookultra.com

Practical JavaScript DOM Scripting and Ajax


Projects 1st Edition Frank Zammetti

_____ Tap the link below to start your download _____

https://ebookultra.com/download/practical-javascript-dom-
scripting-and-ajax-projects-1st-edition-frank-zammetti/

Find ebooks or textbooks at ebookultra.com today!


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookultra.com
to discover even more!

DOM Scripting Web Design with JavaScript and the Document


Object Model 2nd Edition Jeremy Keith

https://ebookultra.com/download/dom-scripting-web-design-with-
javascript-and-the-document-object-model-2nd-edition-jeremy-keith/

DOM Scripting Web Design with JavaScript and the Document


Object Model Second Edition Jeremy Keith

https://ebookultra.com/download/dom-scripting-web-design-with-
javascript-and-the-document-object-model-second-edition-jeremy-keith/

Learn JavaScript and Ajax with w3Schools 1st Edition


W3Schools

https://ebookultra.com/download/learn-javascript-and-ajax-
with-w3schools-1st-edition-w3schools/

Zk Ajax without Javascript Framework 1st Edition Henri


Chen

https://ebookultra.com/download/zk-ajax-without-javascript-
framework-1st-edition-henri-chen/
JavaScript Ajax for Dummies 1. Edition Andy Harris

https://ebookultra.com/download/javascript-ajax-for-dummies-1-edition-
andy-harris/

Scripting in Java Integrating with Groovy and JavaScript


1st Edition Kishori Sharan

https://ebookultra.com/download/scripting-in-java-integrating-with-
groovy-and-javascript-1st-edition-kishori-sharan/

DHTML Utopia Modern Web Design Using JavaScript DOM 1st


edition Edition Stuart Langridge

https://ebookultra.com/download/dhtml-utopia-modern-web-design-using-
javascript-dom-1st-edition-edition-stuart-langridge/

AJAX Creating Web Pages with Asynchronous JavaScript and


XML 1st Edition Edmond Woychowsky

https://ebookultra.com/download/ajax-creating-web-pages-with-
asynchronous-javascript-and-xml-1st-edition-edmond-woychowsky/

MooTools Essentials The Official MooTools Reference for


JavaScript and Ajax Development 1st Edition Aaron Newton

https://ebookultra.com/download/mootools-essentials-the-official-
mootools-reference-for-javascript-and-ajax-development-1st-edition-
aaron-newton/
Practical JavaScript DOM Scripting and Ajax Projects
1st Edition Frank Zammetti Digital Instant Download
Author(s): Frank Zammetti
ISBN(s): 9781590598160, 1590598164
Edition: 1
File Details: PDF, 6.20 MB
Year: 2007
Language: english
Practical JavaScript™,
DOM Scripting, and
Ajax Projects

■■■

Frank W. Zammetti
Practical JavaScript™, DOM Scripting, and Ajax Projects
Copyright © 2007 by Frank W. Zammetti
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-816-0
ISBN-10 (pbk): 1-59059-816-4
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the
United States and other countries. Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book
was written without endorsement from Sun Microsystems, Inc.
Lead Editor: Matthew Moodie
Technical Reviewer: Herman van Rosmalen
Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick,
Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Jeff Pepper, Paul Sarknas, Dominic
Shakeshaft, Jim Sumser, Matt Wade
Project Manager: Tracy Brown Collins
Copy Edit Manager: Nicole Flores
Copy Editor: Marilyn Smith
Assistant Production Director: Kari Brooks-Copony
Production Editor: Laura Esterman
Compositor: Susan Glinert
Proofreaders: Lori Bring and April Eddy
Indexer: Broccoli Information Management
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or
visit http://www.springeronline.com.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA
94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Source Code/Download
section.
Dedicated to all the animals I’ve eaten over the years, without whom I
most certainly would have died a long time ago due to starvation. Well, I suppose
I could have been a vegan, but then I’d have to dedicate this to all the plants
I’ve eaten, and that would just be silly because very few plants can read.

To all my childhood friends who provided me with cool stories to tell: Joe, Thad,
Meenie, Kenny, Franny, Tubby, Stubby, Kenway, JD, dVoot, Corey, and Francine.

To Denny Crane, for raising awareness of Mad Cow disease.

Hmm, who am I forgetting? Oh yeah, and to my wife and kids.


You guys make life worth living.
Contents at a Glance

About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv


About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
About the Illustrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

PART 1 ■■■ Say Hello to My Little Friend:


JavaScript!
■CHAPTER 1 A Brief History of JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
■CHAPTER 2 The Seven Habits of Highly Successful
JavaScript Developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

PART 2 ■■■ The Projects


■CHAPTER 3 Hodgepodge: Building an Extensible JavaScript Library . . . . . . . . 71
■CHAPTER 4 CalcTron 3000: A JavaScript Calculator . . . . . . . . . . . . . . . . . . . . . . 107
■CHAPTER 5 Doing the Monster Mash: A Mashup . . . . . . . . . . . . . . . . . . . . . . . . . 147
■CHAPTER 6 Don’t Just Live in the Moment: Client-Side Persistence . . . . . . . 185
■CHAPTER 7 JSDigester: Taking the Pain Out of Client-Side XML . . . . . . . . . . . 231
■CHAPTER 8 Get It Right, Bub: A JavaScript Validation Framework . . . . . . . . . 261
■CHAPTER 9 Widget Mania: Using a GUI Widget Framework . . . . . . . . . . . . . . . 305
■CHAPTER 10 Shopping in Style: A Drag-and-Drop Shopping Cart . . . . . . . . . . . 351
■CHAPTER 11 Time for a Break: A JavaScript Game . . . . . . . . . . . . . . . . . . . . . . . . 403
■CHAPTER 12 Ajax: Where the Client and Server Collide . . . . . . . . . . . . . . . . . . . . 465

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525

v
Contents

About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv


About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
About the Illustrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

PART 1 ■■■ Say Hello to My Little Friend:


JavaScript!
■CHAPTER 1 A Brief History of JavaScript ..............................3

How JavaScript Came to Exist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


The Evolution of JavaScript: Teething Pains . . . . . . . . . . . . . . . . . . . . . . . . 6
But It’s the Same Code: Browser Incompatibilities . . . . . . . . . . . . . . . 6
Of Snails and Elephants: JavaScript Performance and
Memory Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
The Root of All Evil: Developers! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
DHTML—The Devil’s Buzzword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
The Evolution Continues: Approaching Usability . . . . . . . . . . . . . . . . . . . . 18
Building a Better Widget: Code Structure . . . . . . . . . . . . . . . . . . . . . 19
Relearning Good Habits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
The Final Evolution: Professional JavaScript at Last! . . . . . . . . . . . . . . . . 21
The Browsers Come Around . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Object-Oriented JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
“Responsible” JavaScript: Signs and Portents . . . . . . . . . . . . . . . . . 26
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

vii
viii ■C O N T E N T S

■CHAPTER 2 The Seven Habits of Highly Successful


JavaScript Developers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
More on Object-Oriented JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Simple Object Creation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Object Creation with JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Class Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Which Approach Should You Use? . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Benefits of Object-Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Graceful Degradation and Unobtrusive JavaScript . . . . . . . . . . . . . . . . . . 35
Keep JavaScript Separate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Allow Graceful Degradation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Don’t Use Browser-Sniffing Routines . . . . . . . . . . . . . . . . . . . . . . . . . 39
Don’t Create Browser-Specific or Dialect-Specific JavaScript . . . . 40
Properly Scope Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Don’t Use Mouse Events to Trigger Required Events . . . . . . . . . . . . 41
It’s Not All Just for Show: Accessibility Concerns . . . . . . . . . . . . . . . . . . . 42
When Life Gives You Grapes, Make Wine: Error Handling . . . . . . . . . . . . 43
When It Doesn’t Go Quite Right: Debugging Techniques . . . . . . . . . . . . . 46
Browser Extensions That Make Life Better . . . . . . . . . . . . . . . . . . . . . . . . 49
Firefox Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
IE Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Maxthon Extension: DevArt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
JavaScript Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Dojo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Java Web Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Script.aculo.us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Yahoo! User Interface Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
MochiKit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Rico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Mootools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
■C O N T E N T S ix

PART 2 ■■■ The Projects


■CHAPTER 3 Hodgepodge: Building an Extensible
JavaScript Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Bill the n00b Starts the Day . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Overall Code Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Creating the Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Building the jscript.array Package . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Building the jscript.browser Package . . . . . . . . . . . . . . . . . . . . . . . . . 78
Building the jscript.datetime Package . . . . . . . . . . . . . . . . . . . . . . . . 78
Building the jscript.debug Package . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Building the jscript.dom Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Building the jscript.form Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Building the jscript.lang Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Building the jscript.math Package . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Building the jscript.page Package . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Building the jscript.storage Package . . . . . . . . . . . . . . . . . . . . . . . . . 94
Building the jscript.string Package . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Testing All the Pieces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

■CHAPTER 4 CalcTron 3000: A JavaScript Calculator . . . . . . . . . . . . . . . . . 107


Calculator Project Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . 107
A Preview of CalcTron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Rico Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Dissecting the CalcTron Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Writing calctron.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Writing CalcTron.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Writing Classloader.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Writing Mode.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Writing Standard.json and Standard.js . . . . . . . . . . . . . . . . . . . . . . . 131
Writing BaseCalc.json and BaseCalc.js . . . . . . . . . . . . . . . . . . . . . . 140
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
x ■C O N T E N T S

■CHAPTER 5 Doing the Monster Mash: A Mashup . . . . . . . . . . . . . . . . . . . . 147


What’s a Mashup? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Monster Mash(up) Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . 148
The Yahoo APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Yahoo Maps Map Image Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Yahoo Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
The Google APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Script.aculo.us Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
A Preview of the Monster Mash(up) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Dissecting the Monster Mash(up) Solution . . . . . . . . . . . . . . . . . . . . . . . 161
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Writing mashup.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Writing ApplicationState.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Writing Hotel.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Writing SearchFuncs.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Writing Masher.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Writing CallbackFuncs.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Writing MapFuncs.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Writing MiscFuncs.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

■CHAPTER 6 Don’t Just Live in the Moment:


Client-Side Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Contact Manager Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . 185
Dojo Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Dojo and Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Dojo Widgets and Event System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Local Shared Objects and the Dojo Storage System . . . . . . . . . . . 190
A Preview of the Contact Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Dissecting the Contact Manager Solution . . . . . . . . . . . . . . . . . . . . . . . . 194
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Writing dojoStyles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Writing index.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Writing goodbye.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Writing EventHandlers.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Writing Contact.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Writing ContactManager.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Writing DataManager.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
■C O N T E N T S xi

Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229


Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

■CHAPTER 7 JSDigester: Taking the Pain Out of Client-Side XML . . . . 231

Parsing XML in JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231


JSDigester Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
How Digester Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Dissecting the JSDigester Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Writing the Test Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Understanding the Overall JSDigester Flow . . . . . . . . . . . . . . . . . . 244
Writing the JSDigester Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Writing the Rules Classes Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

■CHAPTER 8 Get It Right, Bub: A JavaScript


Validation Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
JSValidator Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
How We Will Pull It Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
The Prototype Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
A Preview of JSValidator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Dissecting the JSValidator Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Writing index.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Writing jsv_config.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Writing JSValidatorObjects.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Writing JSValidator.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Writing JSValidatorBasicValidators.js . . . . . . . . . . . . . . . . . . . . . . . . 297
Writing DateValidator.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

■CHAPTER 9 Widget Mania: Using a GUI Widget Framework . . . . . . . . . 305

JSNotes Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305


The YUI Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
A Preview of JSNotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
xii ■C O N T E N T S

Dissecting the JSNotes Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310


Writing index.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Writing Note.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Writing JSNotes.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

■CHAPTER 10 Shopping in Style: A Drag-and-Drop Shopping Cart . . . . 351


Shopping Cart Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . . . 351
Graceful Degradation, or Working in the Stone Age . . . . . . . . . . . . . . . . 352
The MochiKit Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
The Mock Server Technique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
A Preview of the Shopping Cart Application . . . . . . . . . . . . . . . . . . . . . . 359
Dissecting the Shopping Cart Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Writing index.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Writing main.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Writing idX.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Writing CatalogItem.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Writing Catalog.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Writing CartItem.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Writing Cart.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Writing viewCart.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Writing checkout.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Writing mockServer.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

■CHAPTER 11 Time for a Break: A JavaScript Game . . . . . . . . . . . . . . . . . . . 403


K&G Arcade Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
A Preview of the K&G Arcade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Dissecting the K&G Arcade Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Writing index.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Writing GameState.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Writing globals.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
■C O N T E N T S xiii

Writing main.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417


Writing consoleFuncs.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Writing keyHandlers.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Writing gameFuncs.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Writing MiniGame.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Writing Title.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Writing GameSelection.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Writing CosmicSquirrel.js. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Writing Deathtrap.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
Writing Refluxive.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463

■CHAPTER 12 Ajax: Where the Client and Server Collide . . . . . . . . . . . . . . 465


Chat System Requirements and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
The “Classic” Web Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Ajax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
The Ajax Frame of Mind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Accessibility and Similar Concerns . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Ajax: A Paradigm Shift for Many . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
The “Hello World” of Ajax Examples. . . . . . . . . . . . . . . . . . . . . . . . . 474
JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Mootools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
A Preview of the Chat Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Dissecting the Chat Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Writing SupportChat.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
Writing ChatMessage.js . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Writing styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
Writing index.htm and index_support.htm. . . . . . . . . . . . . . . . . . . . 501
Writing chat.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
Writing goodbye.htm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Creating the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Writing the Server Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Suggested Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
About the Author

■FRANK W. ZAMMETTI is a web architect specialist for a leading worldwide financial company by
day, and a PocketPC and open source developer by night. He is the founder and chief software
architect of Omnytex Technologies, a PocketPC development house.
Frank has more than 13 years of “professional” experience in the IT field, and over 12 more
of “amateur” experience. He began his nearly lifelong love of computers at age 7, when he became
one of four students chosen to take part in the school district’s pilot computer program. A year
later, he was the only participant left! The first computer Frank owned was a Timex Sinclair 1000,
in 1982, on which he wrote a program to look up movie times for all of Long Island (and without
the 16kb expansion module!). After that, he moved on to an Atari computer, and then a
Commodore 64, where he spent about four years doing nothing but assembly programming
(games mostly). He finally got his first IBM-compatible PC in 1987, and began learning the finer
points of programming (as they existed at that time!).
Frank has primarily developed web-based applications for about eight years. Before that,
he developed Windows-based client/server applications in a variety of languages. Frank holds
numerous certifications, including SCJP, MCSD, CNA, i-Net+, A+, CIW Associate, MCP, and
numerous BrainBench certifications. He is a contributor to a number of open source projects,
including DataVision, Struts, PocketFrog, and Jakarta Commons. In addition, Frank has started
two projects: Java Web Parts and The Struts Web Services Enablement Project. He also was one
of the founding members of a project that created the first fully functioning Commodore 64
emulator for PocketPC devices (PocketHobbit).
Frank has authored various articles on topics that range from integrating DataVision into
web applications to using Ajax in Struts-based applications, as well as a book on Ajax for Apress.
He is currently working on a new application framework specifically geared to creating next-
generation web applications.
Frank lives in the United States with his wife Traci, his two kids Andrew and Ashley, and his
dog Belle. And an assortment of voices in his head, but the pills are supposed to stop that.

xv
About the Technical Reviewer

■HERMAN VAN ROSMALEN works as a developer/software architect for De Nederlandsche Bank N.V.,
the central bank of the Netherlands. He has more than 20 years of experience in developing
software applications in a variety of programming languages. Herman has been involved in
building mainframe, PC, and client/server applications. For the past six years, however, he has
been involved mainly in building J2EE web-based applications. After working with Struts
(pre-1.0) for years, he got interested in Ajax and joined the Java Web Parts open source project
in 2005.
Herman lives in a small town, Pijnacker, in the Netherlands, with his wife Liesbeth and
their children, Barbara, Leonie, and Ramon.

xvii
About the Illustrator

■ANTHONY VOLPE did the illustrations for this book and the K&G Arcade game. He has worked on
several video games with author Frank Zammetti, including Invasion Trivia!, Io Lander, and
Ajax Warrior. Anthony lives in Collegeville, Pennsylvania, and works as a graphic designer and
front-end web developer. His hobbies include recording music, writing fiction, making video
games, and going to karaoke bars to make a spectacle of himself.

xix
Exploring the Variety of Random
Documents with Different Content
The Project Gutenberg eBook of The Borzoi
1920
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: The Borzoi 1920


Being a sort of record of five years' publishing

Creator: Inc. Alfred A. Knopf

Contributor: Conrad Aiken


Willa Cather
Floyd Dell
T. S. Eliot
Robert Graves
H. L. Mencken
Ezra Pound
Carl Van Vechten

Release date: January 17, 2017 [eBook #53979]


Most recently updated: October 23, 2024

Language: English

Credits: Produced by Richard Tonsing and the Online Distributed


Proofreading Team at http://www.pgdp.net (This file
was
produced from images generously made available by
The
Internet Archive)
*** START OF THE PROJECT GUTENBERG EBOOK THE BORZOI
1920 ***
A PAGE FROM THE
MANUSCRIPT OF MAX
BEERBOHM’S “SEVEN
MEN”
THE BORZOI 1920

Being a sort of record of five years’ publishing

New York
ALFRED · A · KNOPF
1920
COPYRIGHT, 1920, BY
ALFRED A. KNOPF, Inc.

PRINTED IN THE UNITED STATES OF AMERICA


FOREWORD

Many readers have doubtless long been familiar with the catalogs
issued now and again by European publishers—no bare lists of
authors and titles, but such wholly charming productions as, for
example, the annual almanacks of the Insel-Verlag of Leipzig. As I
approached the conclusion of my first five years’ publishing it
seemed to me—in view of the uncommon friendliness of so many
readers—that they, at any rate, would perhaps receive with favor a
more permanent record of the early activities of the Borzoi than it
would be possible to present in the usual sort of American
publisher’s announcement. Authors—may I say my authors?—
greeted the idea with such enthusiasm (how generous their
coöperation the following pages abundantly testify) that it soon took
fairly definite shape. The original papers are of course the real
excuse for The Borzoi 1920, while the balance of the book is
intended simply to be useful—to the individual reader, the bookseller,
and the librarian. I have tried to make the bibliography complete,
but the Who’s Who is confined to writers who are, I hope, more or
less definitely associated with my list (and from whom I could get
the necessary information).
My best thanks are due many for whatever success Borzoi Books
may have achieved. Those, first, who wrote them, and especially the
generous contributors to this volume; the booksellers, who have
been both friendly and intelligent in their coöperation; the critics
who have been for the most part both understanding and
encouraging; the loyal co-workers in my own office; and last, but not
least, the readers who have made the whole venture possible.
Alfred A. Knopf.
CONTENTS

PAGE

Introduction Maxim Gorky ix

PART ONE

WRITTEN ESPECIALLY FOR THE BORZOI 1920 1

The Movies Claude Bragdon 3

Maxwell Bodenheim Witter Bynner 6

On the Art of Fiction Willa Cather 7

Astonishing Psychic Experience Clarence Day, Jr. 9

Max Beerbohm Floyd Dell 12

Joseph Hergesheimer Wilson Follett 15

On Drawing A. P. Herbert 20
A Note on the Chinese Poems Joseph 24
translated by Arthur Waley Hergesheimer

Willa Cather H. L. Mencken 28

Van Vechten Philip Moeller 32

On H. L. Mencken George Jean 34


Nathan

A Sketch Sidney L. Nyburg 37

Chant of the Nurses Eunice Tietjens 41

A Memory of Ypres H. M. Tomlinson 42

On the Advantages of Being Born on Carl Van Vechten 48


the Seventeenth of June

The Master of the Five Willows Arthur Waley 52

PART TWO

A BRIEF WHO’S WHO OF WRITERS PARTICULARLY 53


IDENTIFIED WITH THE BORZOI

PART THREE

SELECTED PASSAGES FROM BORZOI BOOKS 63


How He Died Conrad Aiken 65

From “Youth and Egolatry” Pío Baroja 68

From “The Romantic Woman” Mary Borden 71

October Robert Bridges 74

“Letters of a Javanese Princess” Louis Couperas 75

April Charms William H. Davies 79

A page from “The Three Mulla Walter de la Mare 80


Mulgars”

Burbank with a Baedeker; Bleistein T. S. Eliot 81


with a Cigar

From “Where Angels Fear to Tread” E. M. Forster 83

Dorothy Easton’s “The Golden Bird” John Galsworthy 86

War and the Small Nations Kahlil Gibran 88

A First Review Robert Graves 89

Joe Ward E. W. Howe 90

Doc Robinson E. W. Howe 92


John Davis E. W. Howe 92

Concerning “A Little Boy Lost” W. H. Hudson 93

Ancient Music Ezra Pound 96

Fire and the Heart of Man J. C. Squire 97

Preface to “Deliverance” E. L. Grant 101


Watson

PART FOUR

A BIBLIOGRAPHY OF ALL BORZOI BOOKS FROM 25 103


SEPTEMBER 1915 TO 25 SEPTEMBER 1920

Postscript 133
ILLUSTRATIONS

A Page from the Manuscript of Max Beerbohm’s Frontispiece


“Seven Men”

FACING
PAGE

Witter Bynner 6

Floyd Dell 12

Clarence Day, Jr. 12

Joseph Hergesheimer 15

Sidney L. Nyburg 28

Willa Cather 28

Carl Van Vechten 32

H. L. Mencken 34

George Jean Nathan 34


Eunice Tietjens 41

Pío Baroja 41

Mary Borden 72

Kahlil Gibran 89

Robert Graves 90

J. C. Squire 90

E. L. Grant Watson 102


INTRODUCTION

[The following—reprinted from the Athenæum (London) of June 11th, 1920, and
translated by S. Kotliansky is part of Gorky’s preface to the first catalogue of
“World Literature,” the publishing house founded by him under the auspices of the
Bolshevik government. It is reprinted here as a plea, as noble as it is typical of
Gorky, for good books.
A. A. K.]

Is it necessary to speak of the necessity of a serious study of


literature, or at least of a wide acquaintance with it? Literature is the
heart of the world, winged with all its joys and sorrows, with all the
dreams and hopes of men, with their despair and wrath, with their
reverence before the beauty of nature, their fears in face of her
mysteries. This heart throbs violently and eternally with the thirst of
self-knowledge, as though in it all those substances and forces of
nature that have created the human personality as the highest
expression of their complexity and wisdom aspired to clarify the
meaning and aim of life.
Literature may also be called the all-seeing eye of the world, whose
glance penetrates into the deepest recesses of the human spirit. A
book—so simple a thing and so familiar—is, essentially, one of the
great and mysterious wonders of the world. Some one unknown to
us, sometimes speaking an incomprehensible language, hundreds of
miles away, has drawn on paper various combinations of a score or
so of signs, which we call letters, and when we look at them, we
strangers, remote from the creator of the book, mysteriously
perceive the meaning of all the words, the ideas, the feelings, the
images; we admire the description of the scenes of nature, take
delight in the beautiful rhythm of speech, the music of the words.
Moved to tears, angry, dreaming, sometimes laughing over the
motley printed sheets, we grasp the life of the spirit, akin or foreign
to ourselves. The book is, perhaps, the most complicated and
mightiest of all the miracles created by man on his path to the
happiness and power of the future.
There is no one universal literature, for there is yet no language
common to all, but all literary creation, in prose and poetry, is
saturated with the unity of feelings, thoughts, ideals shared by all
men, with the unity of man’s sacred aspiration towards the joy of the
freedom of the spirit, with the unity of man’s disgust at the miseries
of life, the unity of his hopes of the possibility of higher forms of life,
and with the universal thirst for something indefinable in word or
thought, hardly to be grasped by feeling, that mysterious something
to which we give the pale name of beauty, and which comes to an
ever brighter and more joyous flower in the world, in our own
hearts.
Whatever may be the inward differences of nations, races,
individualities, however distinct may be the external forms of states,
religious conceptions and customs, however irreconcilable the
conflict of classes—over all these differences, created by ourselves
through centuries, hovers the dark and menacing spectre of the
universal consciousness of the tragic quality of life and the poignant
sense of the loneliness of man in the world.
Rising from the mystery of birth, we plunge into the mystery of
death. Together with our planet we have been thrown into
incomprehensible space. We call it the Universe, but we have no
precise conception of it, and our loneliness in it has such an ironical
perfection that we have nothing with which to compare it.
The loneliness of man in the Universe and on the earth, which is to
many “a desert, alas! not unpeopled”—on earth amid the most
tormenting contradiction of desires and possibilities—is realized only
by few. But the faint feeling of it is implanted in the instinct of nearly
every man like a noxious weed, and it often poisons the lives of men
who appear to be perfectly immune from that murderous nostalgia
which is the same for all ages and peoples, which tormented equally
Byron the Englishman, Leopardi the Italian, the writer of
“Ecclesiastes,” and Lao-Tse, the great sage of Asia.
This anguish that arises from the dim sense of the precariousness
and tragedy of life is common to great and small, to every one who
has the courage to look at life with open eyes. And if a time is to
come when men will have overcome this anguish and stifled in
themselves the consciousness of tragedy and loneliness, they will
achieve that victory only by the way of spiritual creation, only by the
combined efforts of literature and science.
Besides its envelope of air and light all our earth is surrounded with
a sphere of spiritual creativeness, with the multifarious rainbow
emanation of our energy, out of which is woven, forged or moulded
all that is immortally beautiful; out of which are created the
mightiest ideas and the enchanting complexity of our machines, the
amazing temples and tunnels that pierce the rock of great
mountains, books, pictures, poems, millions of tons of iron flung as
bridges across wide rivers, suspended with such miraculous lightness
in the air—all the stern and lovely, all the mighty and tender poetry
of our life.
By the victory of the mind and will over the elements of nature and
the animal in man, striking out ever brighter sparks of hope from the
iron wall of the unknown, we men can speak with legitimate joy of
the planetary significance of the great efforts of our spirit, most
resplendently and powerfully expressed in literary and scientific
creation.
The great virtue of literature is that by deepening our consciousness,
by widening our perception of life, by giving shape to our feelings, it
speaks to us as with a voice saying: All ideals and acts, all the world
of the spirit is created out of the blood and nerves of men. It tells us
that Hen-Toy, the Chinaman, is as agonizingly unsatisfied with the
love of woman as Don Juan, the Spaniard; that the Abyssinian sings
the same songs of the sorrows and joys of love as the Frenchman;
that there is an equal pathos in the love of a Japanese Geisha and
Manon Lescaut; that man’s longing to find in woman the other half
of his soul has burned and burns with an equal flame men of all
lands, all times.
A murderer in Asia is as loathsome as in Europe; the Russian miser
Plushkin is as pitiable as the French Grandet; the Tartufes of all
countries are alike, Misanthropes are equally miserable everywhere,
and everywhere every one is equally charmed by the touching image
of Don Quixote, the Knight of the Spirit. And after all, all men, in all
languages, always speak of the same things, of themselves and their
fate. Men of brute instincts are everywhere alike, the world of the
intellect alone is infinitely varied.
With a clearness irresistibly convincing, fine literature gives us all
these innumerable likenesses and infinite varieties—literature, the
pulsing mirror of life, reflecting with quiet sadness or with anger,
with the kindly laugh of a Dickens or the frightful grimace of
Dostoevsky, all the complications of our spiritual life, the whole world
of our desires, the bottomless stagnant pools of banality and folly,
our heroism and cowardice in the face of destiny, the courage of
love and the strength of hatred, all the nastiness of our hypocrisy
and the shameful abundance of lies, the disgusting stagnation of our
minds and our endless agonies, our thrilling hopes and sacred
dreams—all by which the world lives, all that quivers in the hearts of
men. Watching man with the eyes of a sensitive friend, or with the
stern glance of a judge, sympathizing with him, laughing at him,
admiring his courage, cursing his nullity—literature rises above life,
and, together with science, lights up for men the paths to the
achievement of their goals, to the development of what is good in
them.
At times enchanted with the beautiful aloofness of science, literature
may become infatuated with a dogma, and then we see Emile Zola
viewing man only as a “belly,” constructed “with charming
coarseness,” and we also see how the cold despair of Du Bois
Reymond infects so great an artist as Gustave Flaubert.
It is obvious that literature cannot be completely free from what
Turgeniev called “the pressure of time”; it is natural, for “sufficient
unto the day is the evil thereof.” And it may be that the evil of the
day poisons more often than it should the sacred spirit of beauty,
and our search for its “inspirations and prayers”; these inspirations
and prayers are poisoned by the venomous dust of the day. But “the
beautiful is the rare,” as Edmond Goncourt justly said, and we most
certainly often consider lacking in beauty and insignificant habitual
things—those habitual things which, as they recede into the past,
acquire for our descendants all the marks and qualities of true,
unfading beauty. Does not the austere life of ancient Greece appear
to us beautiful? Does not the bloody, stormy and creative epoch of
the Renaissance with all its “habitual” cruelty enrapture us? It is
more than probable that the great days of the social catastrophe we
are going through now will arouse the ecstasy, awe and creativeness
of the generations that will come after us.
Nor let us forget that though Balzac’s “Poor Relations,” Gogol’s “Dead
Souls,” “The Pickwick Papers,” are essentially books that describe
conditions of actual life, there is hidden in them a great and
imperishable lesson which the best university cannot provide, and
which an average man will not have learnt so exactly or so clearly
after fifty years of hard-working life.
The habitual is not always banal, for it is habitual for man to be
consumed in the hell fire of his vocation, and this self-consumption is
always beautiful and necessary, as it is instructive for those who
timidly smoulder all their life long, without blazing up in the bright
flame that destroys the man and illuminates the mysteries of his
spirit.
Human errors are not so characteristic of the art of the word and
image; more characteristic is its longing to raise man above the
external conditions of existence, to free him from the fetters of the
degrading actuality, to show him to himself not as the slave, but as
the lord of circumstance, the free creator of life, and in this sense
literature is ever revolutionary.
By the mighty effort of genius rising about all circumstances of
actuality, saturated with the spirit of humanity, kindling its hatred
from the excess of passionate love, fine literature, prose and poetry,
is our great vindication, and not our condemnation. It knows that
there are no guilty—although everything is in man, everything is
from man. The cruel contradictions of life that arouse the enmity and
hatred of nations, classes, individuals, are to literature only an
inveterate error, and she believes that the ennobled will of men can
and must destroy all errors, all that which, arresting the free
development of the spirit, delivers man into the power of animal
instincts.
When you look closely into the mighty stream of creative energy
embodied in the word and image, you feel and believe that the great
purpose of this stream is to wash away for ever all the differences
between races, nations, classes, and, by freeing men from the hard
burden of the struggle with each other, to direct all their forces to
the struggle with the mysterious forces of nature. And it seems that
then the art of the word and image is and will be the religion of all
mankind—a religion that absorbs everything that is written in the
sacred writings of ancient India, in the Zend-Avesta, in the Gospels
and Koran.
Maxim Gorky
PART ONE

WRITTEN ESPECIALLY
FOR
THE BORZOI 1920
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like