Download PDF Javascript learn javascript in 24 hours or less a beginner s guide to learning javascri

Page 1


JavaScript Learn JavaScript in 24 Hours or Less A Beginner s Guide To Learning JavaScript Programming Now JavaScript JavaScript Programming 1st Edition Robert Dwight.

Visit to download the full and correct content document: https://textbookfull.com/product/javascript-learn-javascript-in-24-hours-or-less-a-begin ner-s-guide-to-learning-javascript-programming-now-javascript-javascript-programmin g-1st-edition-robert-dwight/

More products digital (pdf, epub, mobi) instant download maybe you interests ...

Head First JavaScript Programming, 2nd Edition: A Learner’s Guide to Modern JavaScript Eric Freeman

https://textbookfull.com/product/head-first-javascriptprogramming-2nd-edition-a-learners-guide-to-modern-javascripteric-freeman/

Head First JavaScript Programming, 2nd Edition: A Learner’s Guide to Modern JavaScript Eric Freeman

https://textbookfull.com/product/head-first-javascriptprogramming-2nd-edition-a-learners-guide-to-modern-javascripteric-freeman-2/

JavaScript Object Programming Rinehart Martin

https://textbookfull.com/product/javascript-object-programmingrinehart-martin/

Beginning Functional JavaScript. Functional Programming with JavaScript using EcmaScript 6 1st Edition Anto Aravinth

https://textbookfull.com/product/beginning-functional-javascriptfunctional-programming-with-javascript-using-ecmascript-6-1stedition-anto-aravinth/

Beginning Functional JavaScript: Functional Programming with JavaScript Using EcmaScript 6 1st Edition Anto Aravinth

https://textbookfull.com/product/beginning-functional-javascriptfunctional-programming-with-javascript-using-ecmascript-6-1stedition-anto-aravinth-2/

Functional Programming in JavaScript How to improve your JavaScript programs using functional techniques

First Edition Luis Atencio

https://textbookfull.com/product/functional-programming-injavascript-how-to-improve-your-javascript-programs-usingfunctional-techniques-first-edition-luis-atencio/

Eloquent Javascript A Modern Introduction to Programming

https://textbookfull.com/product/eloquent-javascript-a-modernintroduction-to-programming-marijn-haverbeke/

Functional Programming in JavaScript How to improve your JavaScript programs using functional techniques 1 edition Edition Luis Atencio

https://textbookfull.com/product/functional-programming-injavascript-how-to-improve-your-javascript-programs-usingfunctional-techniques-1-edition-edition-luis-atencio/

Reactive

Programming with JavaScript 1st Edition

https://textbookfull.com/product/reactive-programming-withjavascript-1st-edition-hayward-jonathan/

JavaScript:

Learn JavaScript In 24 Hours Or Less

Table Of Contents

Introduction

Chapter 1: HTML Overview

Choosing a Text Editor

Choosing a Web Browser

What is HTML?

Chapter 2: Introduction to JavaScript

Piecing Together HTML and JavaScript

a. Internal JavaScript

b. External JavaScript

c. Instant JavaScript

Meet JavaScript

Storing Information

Chapter 3: JavaScript Essentials

Data Types

Knowing what the Interpreter is Thinking

Flow Control

If Statement

Debugging

What to look for when debugging:

Recap

Chapter 4: Functions and Data Manipulation

Mathematical Precedence

A new contender: modulo

Messing with strings

Functions

Return Values

Optimisation: Finding the Perfect Balance Between Readability and Conciseness

Global and Local Variables

Chapter 5: Loops and Arrays

For-Loops

Arrays

A Mini Project: Text-Searching

Still Confused?

Chapter 6: Mastering Flow Control

While Loops

Do-While Loops

If-Else If-Else

Switch Statement

Review

Chapter 7: Managing Data More Efficiently

Arrays - A Quick Review

Two-Dimensional Arrays

Introduction to Objects

Custom Constructors

Chapter 8: Exploring Objects

Identifying Data Types

Distinguishing Between Different Objects

Data Verification

Running through properties in a loop

Conclusion

Bonus: Preview Of “Ruby: Learn Ruby In 24 Hours Or Less – A Beginner’s Guide To Learning Ruby Programming Now”

Object-Oriented Programming

Basic Stuff

Hashes and Arrays

Symbols

Introduction

The Internet has come a long way since the early 90’s. With hundreds of thousands of computers already connected in a network, there arose the dilemma as to how data were to be distributed to different computers in an organized manner. With this in mind, Tim Berners-Lee created a hyperlinking framework known as the Hypertext Transfer Protocol (HTTP). Alongside HTTP he also created a markup language known as the Hypertext Markup Language (HTML).

In modern web browsers, most of the time you no longer have to type in HTTP or HTTPS in order to visit a website. You also won’t see the .html extension very often as you surf the web. These are done in order to simplify the web browsing experience for casual users.

As you may have noticed, there’s a trend among web developers to make things as simple as possible for the web surfers. While the early 2000’s seemed good enough for a lot of people, with the advent of flashy, glossy text and buttons and “click here to enter” flash intros, these elements do not accurately represent the current trend of minimalist, dynamic content. The old sites required you to load and reload different web pages whenever you click a button, which hampers the web surfing experience, as a lot of data would get lost in data fields because you had to keep refreshing web pages to check for updated content. In short, as information grew more dense and complex, there was a need to simplify how we access those bits and pieces of information, otherwise we end up drowning in a sea of data.

This book isn’t a reference guide, nor is it a set of dry academic lectures; it’s a practical walkthrough in JavaScript programming, built on the very idea current web technologies are built upon - the need to simplify.

Before going any further, ask yourself these questions:

Do you have a computer that has a functional browser and an internet connection?

Do you want to learn how to create web pages that can intelligently talk balk to the user and add new information in real time?

Do you prefer friendly walkthroughs over dull and dry reference manuals?

If you’ve answered yes to at least number 2 and 3, this book is for you. In case you’ve answered no to number 1, you may want to consider getting Google Chrome or Mozilla Firefox, both of which are excellent browsers, to start you off, otherwise the sample codes may not work as intended.

Note:

If you truly wish to learn as quickly as you can from this book, then I advise doing ALL the exercises and activities in the chapters. Resist the urge to skim through sample codes without trying them out yourself - running the codes help you understand and apply what you’ve learned. Speed-reading through the chapters will only give you surface-level knowledge - enough to impress programming novices at a dinner party.

Let’s begin the journey.

Chapter 1: HTML Overview

HTML, CSS, and Javascript work in tandem to give users a seamless web experience. A lot of budding web developers have these three confused. If you’re completely new to the world of web development, this chapter should give you a quick tour of HTML. On the other hand, if you already know HTML, feel free to skip or skim this chapter.

Choosing a Text Editor

Before you start creating interactive webpages, you’ll have to download a good text editor. While Macs and PCs usually have built-in text editors that can save files in html format, they lack a lot of useful utilities that make web development a lot easier like syntax highlighting and auto-completion. That being said, here are some of the best text editors for web development:

1. Atom – Atom is a relatively new text editor by Github. It’s free, open source, and has plenty of customization options. Basically, Atom is like a programmable text editor; it can do almost anything you want it to with the right plug-ins. Among its many features would be the Fuzzy finder, which allows you to jump to different files with a simple cmd+t command, and the wide range of available themes. It works on Mac OS X, Windows, and Linux and comes at no cost, so try it out and see if suits you.

2. Sublime Text – Sublime Text is quite aptly named, as it offers a sublime writing experience due to its intuitive commands and beautiful interface. Like Atom, Sublime Text is also highly customizable and works on Mac OSX, Windows, and Linux. Its trial version is free, but the full version costs about $70.

3. Notepad++ - Notepad++ has been a crowd favorite for quite some time because of its unrivaled simplicity and speed. If you just need a no-nonsense text editor that’ll let you edit a couple of html files without the need for complex file structures, you may opt to give this text editor a try. Keep in mind, however, that this text editor is only available in Windows.

4. Brackets – Brackets is quite a unique text editor from Adobe, as it’s designed to work in tandem with Adobe’s other products, specifically Photoshop. If you’re interested in creating sleek user interfaces from Photoshop, Brackets allows you to extract information seamlessly from the PSDs you’ve created and convert them into CSS code. This text editor works with Windows, Linux, and Mac OSX, so if you’re interested in web design, you’ll want to have this installed in your system. If you’re not trying to save space on your system, I recommend downloading these four text editors and trying them out for yourself, assuming that you’re running a compatible operating system. The exercises and code snippets in this book do not require a specific text editor so feel free to jump in and out of different text editors until you find one that fits your needs.

Choosing a Web Browser

Text editors allow you to create and save html files while web browsers allow you to view them. Unfortunately, sometimes, the web pages you create may look and act differently when viewed on different browsers, so here are the browsers you’ll want installed on your system:

Google Chrome – Google Chrome is one of the most popular web browsers because of its speed and simplicity. With its built-in developer tools you get to play around with the web sites you build and change snippets of code on the fly so you can immediately see what lines of code you’ll want to change.

Firefox – Firefox comes with a plug-in called Firebug, which somewhat functions like Google Chrome’s developer tools. It also comes with a mobile preview mode, which basically allows you to see how your website would look when viewed in a mobile device.

Internet explorer – this isn’t something you can install on Linux or Mac OSX and in Windows this comes preinstalled, however, if you are running Windows you’ll want to test your html code using this browser as well, simply because it often messes up configurations that worked on Google Chrome or Firefox.

Vivaldi - a relatively new contender, the first beta was launched only in 2015, with the first stable release launched in 2016. The reason why this browser made it in this list is because it’s made based on modern web technologies such as HTML5 and Node.js among other things. It also runs on Mac, Windows, and Linux, so if you’re looking for a new, cutting edge browser, give this one a try.

What is HTML?

HTML basically allows you to present your site’s content in a structured manner. Think of it as a blueprint for building a house; it tells you where the living room, bathroom, kitchen, and other rooms will be placed and how they harmoniously interconnect.

Learning the structure of an HTML file is quite simple; it’s structured almost like an essay - you provide a title, a skeletal structure, and content that flows coherently within the structure. Whenever you read an article, the title tells you what the article talks about, and the content is structured in a particular way, oftentimes with a sentence that piques your interest, followed by anecdotes, facts and figures, arguments, and a conclusion. When you start coding in HTML, you’ll see how similarly structured it is to articles you read or write.

Creating an HTML file, then, is as simple as saving your file with a .html file extension. When you create documents in a word processor like Microsoft Word, you’ll notice that when you save your file it has either an .odt, .doc, .docx, or something similar at the end of the filename. This tells the computer to read and format the contents of the file in a very specific way. This is because whenever you save something you’ve created using a word processor you’re not just saving a bunch of words you’ve typed; you’re also saving the font size, font styles, and other formatting styles you’ve used so that when you open your file, your computer will check the file extension, read the contents according to the file extension specified, and then present you the file you’ve created, making sure that it looks exactly the same way when you’ve saved it.

HTML basically acts the same way, but this time you use tags in order to tell the computer what to do with the data enclosed by the tags; this allows you to easily change the font styles and other aspects of your web page. Think of HTML as a more precise version of a Word Document. For example, take a look at the text below:

This is a sentence.

If you save this as a Word Document, it will save not only the text, but also its font style, size, and structure. The attributes of the document you’ve just saved is tucked neatly inside the file and accessible only through the word processor menus. However, if you want to display the same sentence in HTML form, the HTML file would look like this:

<html> <head> </head> <body>

<p>This is a sentence.</p>

</body>

</html>

By saving this file with a .html extension, you get a basic webpage that displays “This is a sentence.” Notice how it has the same string of text as the previous text box, but it contains additional tags you may or may not be familiar with. When your browser opens this file, it understands the tags and displays only the content on the previous text box; it doesn’t actually show the tags to the user. The most basic tags are shown in the code example:

The <html> tag - contains everything in your web page. It’s the alpha and the omega, literally; never forget the <html> tag or else your site won’t work properly!

The <head> tag - keeps the title and other preliminary scripts that the body might use. For instance, if you want to use a set of design protocols (typically in the form of CSS) that dictate what type of fonts to use, their colors, etc., you can place the code or its reference here.

The <body> tag - this is where your content goes. From text, to sound, to images, to videos, this is where everything happens.

Don’t worry too much if you don’t yet fully understand how these tags work; you’ll learn better how they work by trying them out in future sample codes and exercises.

HTML Essentials

Now that you have a general overview of how HTML works, we’re going to have a quick run through the basics, just enough to help you learn how to integrate JavaScript seamlessly into it.

We’ve discussed how HTML files are like Word Documents with additional tags, so let’s start with a simple line of text. Type this into your text editor:

Hi There!

Now create a folder in your computer where you can store all the html files are created and save what you’ve just typed with a .html extension (e.g., “My First Website.html”). A standard practice for programmers is to create a folder called ‘Developer’ this is where all your files that pertain to programming are stored. You can place this in your home folder. Inside the Developer folder, create a folder called ‘Web Development’ and for now, place all your html files here. If you’re using TextEdit or other text editors that aren’t built specifically for html files, remember to check the settings and make sure that “Plain text” format is selected.

Now that you’ve created your first html file, open it using any web browser you have and see a simple string of text appear before your very eyes! Notice, however, that what you’ve typed into the text editor (referred to as “source code”) looks just like what the browser displayed; it didn’t have the <html> tags and other stuff. What gives?

Now, try changing your html file by adding a few tags. It should then look like this:

<!DOCTYPE html>

<html>

<body>

Hi There!

</body>

</html>

Now reload your browser and see what happens.

Your browser isn’t malfunctioning; the web page looks pretty much the same despite the addition of tags in the source code. At this point you may not fully understand why tags are used, but don’t worry; you’ll see what they’re for when you start programming in HTML more.

Conclusion

You’ve just had your first dive into HTML- nothing too thorough, just enough of the basics to help you use JavaScript with HTML properly. If you’re interested in learning more about HTML, you’ll want to take a look at online tutorials and references, as well as see how other web developers code their own sites. You can do the latter by right-clicking a site and clicking on ‘view page source’or something along those lines. If you’re ready to take the plunge into JavaScript, head over to chapter 2.

Chapter 2: Introduction to JavaScript

Now that we’ve covered the essentials of HTML, we can now introduce the basics of programming, with JavaScript as the medium. Make sure that you at least understand the backbone of HTML before proceeding, otherwise, feel free to go back to Chapter 1 and skim through the material once more.

Piecing Together HTML and JavaScript

JavaScript conveniently fits into HTML quite readily using the script tag. The script tag can either contain a JavaScript code or a reference to a .js file that contains the JavaScript code. The latter is advised when creating long JavaScript code to avoid mixing up different programming languages in one file - that’d be like writing an essay with some paragraphs in English and some paragraphs in Latin! Internal JavaScript is, however, good to use when you’re testing out small fragments of JavaScript code.

a. Internal JavaScript

If you want to use JavaScript without having to create a .js file, you can simply put the JavaScript inside the script tag as shown below:

<script>

alert(“Hi There!”);

</script> Put this inside your HTML file as show below and check out your first JavaScript code popping-up to greet you!

<!DOCTYPE html>

<html>

<body>

<script>

alert(“Hi There!”);

</script>

</body>

</html> Pretty cool, huh? While this chunk of code is simple enough to understand, when you begin writing websites with more complex codes, keeping different programming/scripting languages in one file becomes rather unwieldy. It makes sense to place the JavaScript code in a separate file so that the HTML code stays neat and easier to maintain. This is where external JavaScript comes in.

b. External JavaScript

Just as you can reference a CSS file from an HTML file to keep the codes separate, you can also keep JavaScript in a separate file and simply reference that file from HTML. In order to use JavaScript code saved in another file, you’ll simply have to use a script tag that contains an src attribute that references the file you’d like to use, as shown below:

<script src=“hello.js”></script>

This code snippet will find a file called “hello.js” and execute whatever JavaScript code is inside it. Make sure, however, that the JavaScript file is located in the same folder where the HTML file is kept.

c. Instant JavaScript

If you’d like to test short JavaScript statements without having to modify the original source code, you can use the consoles provided by Google Chrome and Firefox by right clicking the webpage and clicking on “inspect element”. In the console window/tab, you can type any JavaScript statement you want, and pressing enter executes it immediately. You can either choose this method to test the code snippets in this book, or if you’d like a more traditional approach, you can use the script tags for your JavaScript code and refresh your webpage to update the output. However, in the examples and exercises that’ll be provided, the modern approach of using the console shall be used.

Meet JavaScript

In order to give you a running start in JavaScript, you’re going to try out a few lines of JavaScript code. For now, we’re going to use the console to try out the commands (rightclick any webpage, click inspect, and find the console tab). As you test the succeeding codes, make sure you don’t just passively copy and paste them into the console. Observe the structure of the language and make a couple of guesses as to what the outputs would be before you check. This’ll make it much easier for you to retain what you’re learning.

Type your name and lock it in with two quotation marks, for example:

“Chris”

You’ve just created a string, which is basically just a collection of letters, numbers, and other symbols. We can do plenty of things even with a single string, but for now, let’s make JavaScript count how many letters your name has:

“Chris”.length

You should get 5. That being said, apart from dealing with strings, JavaScript also knows how to do math. Try adding the lengths of your first and last name, for example:

“Chris”.length + “Nicholas”.length

This would give you 13. Now go ahead and play around with this by using actual numbers and trying out multiplication (*), division (/), and subtraction(-).

Notice that while the commands you’ve put in so far are quite intuitive and easy to understand, programming languages require a lot more precision compared to human language. For instance, if you try to read the following “Tihs is a Coemplx Stenence,” you’d be able to decipher the meaning, but in programming languages, if you so much as misplace a period, at best you’d receive an error - at worst a bug. For instance, try inputting the following code:

“Chris”l.ength

This would confuse the interpreter, even if you’ve simply misplaced the period.

Other than misspellings and misplaced symbols, another way to confuse the interpreter is to use commands it doesn’t know about, for instance, if you type:

The interpreter would complain and say that ‘bacon’ is not defined. Because you’ve typed ‘bacon’ without the quotation marks, the interpreter thinks you’re trying to make it perform the ‘bacon’command, which doesn’t exist in the JavaScript library as of now.

What if you simply want to type a bunch of hints and descriptions inside your code? You can tell the interpreter to ignore lines of code simply by typing ‘//’ before the beginning of the line. For example:

//This is a comment. The interpreter won’t care about what I put here, even

//Valid commands like //2+3

//But by removing the ‘//’, 2+3

//You should get 5.

Now, you might be wondering why we’re going through strings, mathematical operations, and comments with JavaScript when you’ve just wanted to make websites come to life, but before you can produce stunning animations, intelligent user-interaction, and other dynamic stuff, we have to lay the groundwork first. Now, let’s have a little fun by creating your first pop-up dialogue box:

confirm(‘Hi! You’ve just made your first pop-up dialogue. Congratulations! Click OK to go further!’);

You after clicking OK, you should see a ‘true’ printed in the console. This is because JavaScript can also record user input, much like HTML. What’s interesting with JavaScript, however, is that it doesn’t need to refresh the page to ask for user input; it simply pops-up a small, separate window to ask you a question, and returns to the web page you were working on. This is especially useful when asking users for confirmation after they’ve filled up a form or decided to delete something - since no webpage refresh is required, the users can go back to whatever they’re doing after clicking OK or CANCEL. Okay, so far, you’ve managed to write your first string, ask JavaScript to compute its length, perform mathematical operations, write comments, and create pop-up confirmation dialogues. In order to make a website do really cool things, however, it needs to be able to get more than just a ‘true’ or a ‘false’ from a user, otherwise strings and mathematical computations would really be useless. With this in mind, let’s try making JavaScript ask for your name:

prompt(‘Hello! What’s your name?’);

After inputting your name, you should see whatever you’ve typed in the console output. Way to go!

Storing Information

Every programming language needs to be able to store information; otherwise there’s no way for it to make calculations and other important procedures, which is what computers were built for in the first place.

So far we’ve only been able to ask for the user’s name, without even doing anything with it. This is because your name wasn’t stored; it was just printed in the console. Let’s use the power of variables so it can greet you after it asks for your name. Here’s how:

var name = prompt(‘What’s your name?’);

alert(‘Hi, ‘ + name + ‘! It’s nice to meet you.’);

Now your program becomes more personal and more human, simply by responding to the user. Don’t worry too much about the syntax if it overwhelms you; you’ll learn more about what the alert() and prompt() functions do, and how you can make your own functions as we dive deeper into JavaScript.

Conclusion

Congratulations! You’ve just gotten your first taste of JavaScript! It’ll get even more interesting in the next chapter as we talk about what types of information you can use and what we can do with them. You’ll also get your first glimpse into how you can help your program make decisions, as well as what to do if the your program doesn’t behave the way you expect it to. It’ll be quite a handful of information to take in one sitting, so take a break and come back when you’re ready to dive further into the essentials of JavaScript.

Chapter 3: JavaScript Essentials

Since this chapter is quite dense, here’s an overview of what you can expect to learn:

1. Data types - how JavaScript classifies information. This is important because knowing what type of information you have will also tell you what you can do with that information (e.g., you can’t multiply 5 with apples.)

2. Comparison Operators - lets you compare certain types of information (e.g., is 5 less than 10?). This is useful when you want to give the computer instructions that relies on certain conditions being met (e.g., allow the user to register only if the age is more than or equal to 18)

3. Console.log() - lets you display the output of a single line of code - useful when you want to see how information flows in your program per line of code.

4. Flow Control - if-else statements give the computer different instructions to execute depending on which condition is met (e.g., allow the user to enter site if the age is more than 18, otherwise, display an error message)

5. Debugging - when your program behaves erratically (e.g., misspelling the user’s name or forgetting it completely), then you need to find which part of your code is messing up your program’s behavior - this process is called debugging. This can become rather daunting when the code spans more than a thousand lines - knowing where to look will come in handy.

So far, you’ve played with strings and numbers using JavaScript. In the programming world, these categories of information are referred to as data types.

Data Types

Data types simply tell the computer how your information should be read. For instance, if you type the following into the console:

“5” + “5”

You’d get “55.” This is because by enclosing 5 using quotation marks, you’re telling the interpreter that you want 5 to be treated as a string, not a number. The addition operator, then, instead of adding the two numbers, combines the two strings. Now try removing the quotation marks and notice how the output changes to 10. There are different things you can do with different data types, so it’s extremely important to know which one to use:

1. Strings - Anything you enclose in quotation marks will end up being a string. This can be a combination of letters, spaces, numbers, punctuation marks, and other symbols. Without strings, you wouldn’t be able to get the user’s name, address, email, and other important details.

2. Numbers - Self-explanatory; numbers are the ones you can perform addition, subtraction, multiplication, and division to, among other mathematical operations. Remember not to put quotation marks or you’ll turn them into strings!

So far, we now have strings and numbers at our disposal, but remember the console output when you’ve tried playing with confirmation dialogues? Whenever you press OK, the console returns true, and whenever you press CANCEL, the console returns false. These outputs aren’t surrounded by quotation marks, but they surely aren’t numbers, so what in the world are they?

3. Booleans - booleans are data types that can only be either true or false. This is different from a string or a number, because it helps the computer make decisions based on whether or not certain conditions are met. For example, if you want to prevent minors from registering in your site, you’d have to have some sort of code to separate minors from the adults, like:

var age = 17

age >= 18

The console, then, returns false because the age is under 18. Now try the following mathematical expressions out and see what you get:

5 > 10

The first line should return false, while the second line should return true.

Comparison Operators

So far, we’ve talked about three data types (numbers, strings, and booleans), as well as some basic mathematical operators (+,, * , /). What you’ve just used to test out booleans, however, are comparison operators (<, > , =), which are extremely important in managing the flow of your program. Here’s the complete list and what they can do:

> Greater than

< Less than

>= Greater than or equal to

<= Less than or equal to

== Equal to

!= Not equal to

To test out these operators, replace the ‘@’ symbol with the correct operator in the following statements in order to make the console output true:

console.log(5 @ 1);

console.log(1 @ 5);

console.log(5 @ 2);

console.log(1 @ 6);

console.log(5 @ 5);

console.log(10 @ 5);

Knowing what the Interpreter is Thinking

Notice how the JavaScript interpreter only gives you the latest output of the commands you type in, so if you’ve typed in three lines of code that should have different outputs:

5 > 10

6 < 12

7 > 14

Executing them all at the same time in the console, you’d only get the result of the last line (false).

You can, instead, enter each line of code individually so you can see the output of each command, but this gets especially tedious in larger bits of code. When you get to more complicated stuff, you’ll eventually run into more errors and bugs. When this happens, you’ll want to know what happens in specific commands you give so that you can pinpoint exactly where things go wrong.

console.log() takes whatever code you put inside and logs its execution to the console. That being said, let’s see console.log() in action:

console.log(5 > 10)

console.log(6 < 12)

console.log(7 > 14)

Now you can see the output of each line of code!

Another random document with no related content on Scribd:

[1091] Cortés, Cartas, 196. Ixtlilxochitl assumes that the submission is tendered through his namesake, as prince of Tezcuco, the only capital of the tripartite empire loyal to the Spaniards Hor Crueldades, 17-18

[1092] Also one old Spaniard, believes Bernal Diaz, who relates his own sufferings minutely, and how he followed some mounted scouts in search of water, which he found, bringing a supply to Cortés Hist Verdad , 133 Vetancurt names this watering-place Topilejo, now San Miguel Teatro Mex , pt iii 155 Chimalpain mentions Quauhxômolco, just before Hist Conq , ii 40

[1093] See Native Races, ii , 345

[1094] Lorenzana, in Cortés, Hist N Esp , 225

[1095] Six, says Cortés.

[1096] Bernal Diaz states that a soldier named Olea was the main instrument in saving Cortés, Hist Verdad , 133; but Ixtlilxochitl, Hist Chich , 311, gives the credit to the Tlascaltec lord Chichimecatl, and Chimalpain to a noble named Ocelotzin Hist Conq , ii 41 Cortés says: ‘Un indio de los de Tlascaltecal,’ Cartas, 199, who could not be found the next day, and Cortés accordingly attributed the aid, writes Herrera, to St Peter, dec iii lib i cap viii

[1097] Followed by other bodies Bernal Diaz, Hist Verdad , 134; Torquemada, i 537

[1098] Cortés leaves the impression that the foremost division of six horse defeated the foe Both Gomara and Herrera are confused, and Prescott and others are led into several mistakes

[1099] Bernal Diaz names two of them

[1100] He even willed that his bones should there be entombed, a request which was not carried out

[1101] ‘No eran cosas de hombres humanos que ayan hecho ningunos vasallos tan grandes servicios a su Rey y dello harian relacion a su Magestad ’ Bernal Diaz, Hist Verdad , 135

[1102] At the junctions of the causeways which led from the different shores to the southern avenue of Mexico The place is also known as Acachinanco

[1103] Bernal Diaz states that Cortés was preparing an ambuscade with ten horse and four equerries when he fell into one himself and lost the two, whom he names

Alarmed at his delay, Alvarado went back to look for him. loc. cit. This is less likely than the version of Cortés.

[1104] Nobles they are termed, and Herrera doubles the number.

[1105] Prescott and others intimate that they passed between the lakes, from Quauhtitlan to Acolman, but Cortés mentions Zilotepec, which may be identical with Citlaltepec, as mentioned by Herrera, or Xilotzinco, about two leagues eastward, as given by Ixtlilxochitl. Bernal Diaz also appears to indicate the northern route

[1106] Bernal Diaz, Hist Verdad , 129

[1107] Bernal Diaz assumes that more than one captain-general was to be appointed. ‘Para boluerse a Cuba, y deshazer a Cortes,’ is all the explanation given by Gomara, Hist Mex , 178

[1108] Such are in substance the words used by Cortés in his relation to the emperor ‘E cómo yo vi que se me habia revelado tan gran traicion, dí gracias á nuestro Señor, porque en aquello consistia el remedio ’ Cartas, 269

[1109] So Cortés intimates, while Herrera states that Villafañe hastened to devour the paper His throat being pressed, about half of it was rescued dec iii lib i cap i He further says that Sandoval was sent to make the arrest; but Bernal Diaz asserts that Cortés went in person, which is likely under the circumstances, and took from Villafañe’s breast the paper Finding thereon so many names of quality he caused it to be rumored that the man had eaten it, or part of it Hist Verdad , 136-7. Clavigero assumes that the culprit revealed the names, and that Cortés preferred not to believe him. Storia Mess., iii. 191. Torture failed to extort any names from him, writes Torquemada, i. 528, and those on the list he declared to be merely of men whom he intended to sound.

[1110] ‘Un alcalde y yo lo condenamos á muerte.’ Cortés, Cartas, 269.

[1111] Bernal Diaz states that he frightened many by having them arrested and threatened with trial; probably those seized with Villafañe. Oviedo, iii. 515, mentions Escudero as executed for plotting; but this is doubtful. As for Verdugo, he became regidor of Mexico, and in 1529 alcalde. He afterward joined Guzman’s expedition and settled at Tonalá in Jalisco. Razon, in Cortés, Residencia, i. 363.

[1112] This was Cortés’ own idea, says Bernal Diaz, and he appealed to us to guard him. Hist. Verdad., 137. Quiñones was succeeded by Francisco de Tenesas [Terrazas]. Ixtlilxochitl, Hist. Chich., 313.

CHAPTER XXXII.

INVESTMENT OF MEXICO.

M-J, 1521.

P H T B L D F A, S, O D, C, E X D T T N B P T C A O P C G E C B D

The ideal heroic character is to be viewed from two standpoints: the effect of heroism on the hero, and on the world. A very bad person may do mankind a great service. An evil-minded man, while sinking his soul yet deeper in corruption, may bring benefactions upon society. But even a fairly good man cannot increase his innate nobleness of character while doing injury to his fellows.

I do not know that the claim of good man was ever advanced for Hernan Cortés, except, indeed, by that strange fanaticism which, dazzled by one object, fails to see other objects, or the terrible means for their attainment. He and his followers formed a sad mixture of good and evil, in which the latter predominated, if judged by the moral standard which they had formed for themselves as soldiers of the cross. The grossest injustice, the most horrible wickedness constituted part of their moral ideal, so that while fighting for the highest morality they were the most immoral of men. Long after the conquest was consummated, under the ministrations of

men of piety and ability, it would seem that the weapons used by these conquerors, who at times justified murder as the highest morality, were still instinct with blood, even as the cornel-wood spear with which the king of Thrace transfixed the unhappy Polydorus springs into life instinct with the blood of Priam’s slaughtered son.

Cortés was not an idealist after the manner of Columbus. Both were full of egoism; the spiritual-mindedness of both was essentially selfish. They would both dictate terms to God and their king, that for so much service they must have so much reward. Both were full of the follies of their day; but Columbus displayed a grave, unconscious folly, while Cortés consciously indulged in all the follies of lust and cruelty that prudence admitted or his aim demanded. Cortés abandoned himself to ambition; Columbus to brooding thought. The insanity of reckless adventure was not the insanity of Columbus, who nevertheless was as mad as any lunatic in his own way. Commanding energy and practical daring were as conspicuous in Cortés as in Columbus; but it happened that the aims of Columbus were of greater import to the race than those of Cortés.

How alike, and yet how different, these men! Cortés was impetuous and extravagant; Columbus calm, calculating, and prudent. One was full of joyous activity, the simple exercise of which was his greatest pleasure; obligations of every sort sat lightly on him; the other was but an instrument in the hands of providence. Both were ambitious, both excessively religious; but Cortés, in the main, made religion subservient to advancement, as before noted, while mundane glories to Columbus were hollow indeed beside his heavenly aspirations. Both were exceedingly great men; both became eminent by a selfish adventure of self; but Columbus saw the New World through the glorious haze of immortality, while Cortés viewed Mexico under the lightly woven covering of personal ambition.

Cortés was an Antony rather than a Cæsar, nor did he lack that one great gift of Antony’s, subordination, as we have seen. He was not so greatly in love with himself, stood not so greatly in awe of himself, as Cæsar; he was possessed of finer perceptions and feelings, and with consummate versatility could drop himself out of his plans as occasion required. Nor was Cortés without imagination and the æsthetic sense, though of a grosser and sensual kind; but it is not in great men that we are to look for the swelling harmonies of nature.

A turning-point was now reached in the campaign. The brigantines were completed, and the siege could begin. The day for the entry of the vessels into the lake was a gala day, inaugurated with the communion and festive with the concourse of gayly attired spectators.[1113] After prayer and a discourse the flags with name and royal arms were hoisted on each vessel,[1114] amid salvos and cheers, and the dams being broken, the gallant fleet floated down the canal to the placid lake.

While the mute bunting was thus proclaiming Spanish supremacy over these inland waters, a Te Deum, in which joined a thousand voices, echoed aloud the gratitude of every heart. Each vessel was placed in charge of a captain[1115] with twenty-four Spaniards, of whom about six were cross-bowmen and arquebusiers, some artillerists to manage the bronze gun, and twelve rowers, six to each side. The boats were evidently halfdecked.[1116]

Active preparations were now made to begin the siege. Tlascaltecs, Huexotzincas, Cholultecs, Chalcans, and other allies were summoned to send in contingents by Whitsunday, the latter to assemble at Chalco, and the Tlascaltecs at Tezcuco. Though but ten days’ notice was given, the last named presented themselves in the

camp before the appointed time to the number of over fifty thousand, which was increased by later reënforcement.[1117]

As they approached Tezcuco under the guidance of Ojeda, and commanded notably by Chichimecatl and Xicotencatl junior, they spread out in one long serpentine file, bristling with iztli points and brilliant with shields and armor covered with variegated devices and flowing plumage, while at intervals waved high the banners of the different corps. Cortés went forth to meet them with grand demonstrations, and as they marched past loud vivas[1118] rent the air.

On the 28th of April Cortés had mustered his forces and found that, with the several reënforcements lately arrived, there were present over nine hundred Spaniards, of whom eighty-six were horsemen and one hundred and eighteen cross-bowmen and arquebusiers;[1119] the rest being armed with swords and shields and the more formidable pikes. They were well protected with cotton armor, many having cuirasses and corselets, and small weapons were not wanting. The artillery consisted of three heavy iron guns, fifteen smaller pieces of bronze, mostly distributed among the vessels, with ten quintals of powder and a quantity of shot, while some fifty thousand arrows had been furnished by the Tezcucan towns, all fitted according to pattern with copper tips.[1120]

Not only had the Spaniards, particularly the new recruits, been well exercised in cavalry movements, target practice, fencing, and pike drill, but the allies had been trained to a certain extent in European tactics. For efficiency and good conduct this army rose far above any yet mustered in the Indies. In the usual speech before the ranks, Cortés pointed out how God had favored them with constant victories and with reënforcements which had nearly doubled their number and resources. They might indeed be hopeful, for holy was their cause. Full of confidence they could march against the only

stronghold yet opposed to them, avenge their slaughtered comrades, and win riches and glory for themselves.

On Whitmonday, the 20th of May, an apportionment of the troops was made to Alvarado, Olid, and Sandoval, who led the cavalry in person, but directed the movements of the infantry through captains, and of the allies through native chiefs. Each received from twentyfour to thirty horsemen, and one hundred and fifty infantry, divided into two or three battalions, with a proportionate number of arquebusiers, cross-bowmen, guns, and ammunition, besides from twenty to forty thousand allies. To Sandoval was given the smallest number of horse and the largest number of allies, those gathered at Chalco having orders to await him, while Alvarado received a full half of the Tlascaltec force, with whom the Tonatiuh was a great favorite. To this leader Tlacopan was assigned for head-quarters; to Olid, Coyuhuacan; and Sandoval received orders to complete the destruction of Iztapalapan, and then to advance through Coyuhuacan and along one of the southern causeways, and there to select his head-quarters, under the protection of the brigantines. These appointments and orders underwent several changes during the siege. For himself Cortés selected the management of the fleet, whereon so much depended during the opening of the siege, and in addition to its ships’ companies of three hundred men he was supported by several thousand allies, chiefly Tezcucans under Ixtlilxochitl, who attended in a large number of canoes. This selection hardly pleased the army, which considered their operations the most important and dangerous, and therefore in need of Cortés’ supervision. But he evidently never intended to remain with the fleet except at the beginning.[1121]

The following day the allied forces apportioned to Alvarado and Olid were ordered to march in advance, for greater convenience, to the border of Tezcuco province and there await the Spaniards. Not many hours after their departure a messenger appeared with the

announcement that Xicotencatl, the companion general of Chichimecatl, had disappeared. Inquiries revealed that shortly before his cousin Piltecuhtli had been severely and wantonly struck by a soldier during a quarrel over some carriers. In order to save the soldier from the wrath of Cortés, Ojeda, the Spanish inspecting officer over the allied forces, smoothed the matter and sent the injured nobleman home. It was claimed by some that this outrage had so wounded Xicotencatl that he followed his cousin. Others assumed that both chiefs were in love with the same woman, and that Xicotencatl could not bear to leave his rival alone in the field. But the true reason lay no doubt in his dislike to fight for the Spaniards, whom he had never ceased to oppose, openly and in secret, as invaders bent on the enslavement of the whole country. This idea, if faint at first, had become more fixed with every fresh blow against his personal ambition, such as the first series of defeats which plucked from him his just renown; the equal or perhaps superior position assigned in the native army to Chichimecatl, of whom he appears to have been deeply jealous;[1122] and the prospect of a wearisome and unprofitable campaign, wherein he must be content to figure as a subordinate, not only of Alvarado, but subject perhaps to the orders of petty Spanish officers. All this became too galling to his proud spirit, and with a few followers he turned toward his mountain home.

It would never do to countenance desertion, and by so prominent a man, at the very opening of a campaign; and Cortés immediately sent a number of troopers in pursuit, with instructions to represent to the chief the gravity of his offence, which cast a heavy stain on Tlascaltec honor, and to persuade him to return. They speedily overtook him, only to meet with insolence. He would not go back; if his people had listened to him they would not now be tools and servants of a horde of foreigners. With this reply the troops were forced to return. “This cacique is incorrigible,” exclaimed Cortés,

“and will ever be a traitor and counsellor to evil. I have had enough of him!” The troopers were at once sent back, accompanied by an alguacil and some trusty Tlascaltec nobles, with orders to arrest the fugitive and bring him to Tezcuco. In a letter to the republican lords, Cortés at the same time complained of the desertion and its grave influence, and declared that according to Spanish law the penalty was death. They replied that the same punishment obtained in Tlascala; and not only do they appear to have actively aided in surrendering the culprit, but they declared all his property, including wives and slaves, confiscated to the crown, against which he had sinned.[1123] Indeed, the arrogance of the young chief does not seem to have endeared him to the other rulers. Instantly on his arrival he was sentenced and hanged on a very high gallows, while the crier and interpreter announced his crime.

The execution of so prominent a chief, heir to one of the rulers among his best allies, was an act which few besides Cortés would have ventured on; but he saw the necessity for a firm observance of discipline, and was not deceived in the salutary effect which it had on the allies.[1124] There were not many Tlascaltecs left in Tezcuco, or a serious demonstration might have occurred; as it was, the mantle and maxtli of the deceased were secured, and an eager contest ensued for them as relics. Axayacatzin Xicotencatl had achieved fame before the advent of the Spaniards.[1125]

Alvarado and Olid had set out from Tezcuco for Tlacopan with their Spanish forces on the 22d of May,[1126] taking the same route by which Cortés had returned from the Xochimilco campaign, and though longer than that north of Tezcuco Lake, yet it was easier and safer. On approaching Acolman, Olid sent a party in advance to secure quarters, and when Alvarado arrived he found every house bearing the green bough on the roof, which indicated occupancy. This raised a tumult between the parties, and even the captains

would have come to blows but for the interference of friends. Informed of the trouble, Cortés took steps to reconcile them, although the two leaders never renewed their former intimacy.

On the evening of the fourth day they reached Tlacopan, which was deserted, as were all the towns along the route.[1127] Late as was the hour, forages and reconnoissances were made, involving a skirmish with the Mexicans. The following day, Sunday, Olid proceeded to Chapultepec to cut the aqueduct which supplied the city, a task which involved another encounter wherein a score of Mexicans fell. Meanwhile the canals were filled and other obstacles removed which might impede a free advance, and foraging tours were made. The Mexicans continued to harass the operations with repeated sallies, and finally Alvarado, with characteristic rashness, pursued them until his troops were well advanced between the houses and bridges. The Mexicans, who had retreated on purpose, now rolled back upon his front and flanks. The roofs, hitherto deserted, teemed with slingers and archers, who showered their missiles with terrible effect, while from the lanes and openings between the houses sprang numbers who assailed the cramped soldiers with their long lances, swords, and clubs, and leaped back into their holes and canoes and behind breastworks whenever they were pressed. The allies were ordered back, and the Spaniards slowly retreated, with a loss of eight killed and fifty wounded, glad to be relieved from their strait.

Olid was highly incensed with Alvarado for his rashness, and regardless of all remonstrance he seized the pretext to hasten the departure to his own camp at Coyuhuacan. He established his headquarters on Corpus Christi day, the 30th of May, and from this date, accordingly, Clavigero and many others date the beginning of the siege. The causeway leading thence to Mexico was broken, and he sought for several days to cover the breaches and gain a footing upon it, but without success. The Mexican warriors displayed great

spirit, and their leaders are to be blamed for not energetically assuming the offensive and attacking the two camps.

The Mexicans had not quite understood the drift of Cortés’ delay and preliminary manœuvres. When they found two camps established, the aqueduct destroyed, and earnest preparations in progress for investment, their eyes were opened; but they were then too bewildered to act with promptness and precision. The chronicles relate that Quauhtemotzin held a grand council to consider the situation, and to sound the spirit of the people for peace or war, so that there might be no faltering when necessity came. A number indeed of the elder and wiser lords, particularly of the Montezuma faction, spoke of the formidable enginery and strength of the Spaniards, and their host of allies, and expressed fears of failure. With the occupation of all the surrounding territory, and the influx of people from abroad, the food supply might fall short, and famine and sickness ensue. But the young men and the warriors, as might be expected, would listen to no counsellor whose words implied cowardice; they were enthusiastic for resistance, and formed too numerous a party to allow the entertaining of peace proposals. Quauhtemotzin cautiously refrained from committing himself,[1128] but reminded the assembly that the oracles of their gods and heroic ancestors had above all to be listened to in so important a matter as the preservation of the homes and sacred temples intrusted to their care. He knew well what answer would come from the priests, whose possessions, wealth, and honors depended on the exclusion of invaders, aiming above all at the overthrow of their religion. “My people shall not fear the enemy,” spake the war-god Huitzilopochtli, “for the allied hosts will not persevere long in the siege, and I will scatter the Castilians now as hitherto.” This utterance suited many views, and the declaration for war was solemnized by sacrifices of human beings, including the four Spaniards lately captured.[1129]

Renewed efforts were made to fortify and supply the city, and canoes were collected to aid in the defence. With insolent assurance, derived from the oracles, corps of warriors would advance close to the Spanish camps and vent their feelings with insults and menaces, “Men of evil, you shall pay for your madness! Behold, the gods have already feasted on your bodies!” they cried, flinging in among the horrified soldiers pieces of their sacrificed comrades. “Our snakes shall drink your blood, and our tigers devour your flesh, though they are already satiated therewith. And you, infamous Tlascaltecs, slaves and traitors! you shall atone for your misdeeds; you shall die a bad death, and furnish flesh for our banquets! Behold!” And therewith they threw in disjointed pieces of dusky human bodies. “We shall not rest till your land is desolated, and not a man or woman left to perpetuate your vile race.” Unabashed by this tirade the Tlascaltecs told them not to threaten like women, but to act like men. Still it were better for them to yield unless they wished to be destroyed.

Cortés had been delayed till the fleet should be fully prepared. On the 31st of May, following Corpus Christi day, he was able to despatch Sandoval, who, reënforced by some forty thousand allies awaiting him on the Chalco border, marched against Iztapalapan. Although severely crippled by Cortés’ expedition, this town still figured as a stronghold of too great importance to be left in the rear Advised of the movement, the Mexicans hurried by road and water to aid in covering the retreat of the inhabitants. Suddenly smoke columns were observed in different parts of the lake, and cries of alarm ran through the town. Yet more and more hurriedly the people fled, and while one body of warriors retired along the causeway to Mexico, others departed in canoes. The Spanish forces pressed onward in close pursuit, and slaughter, pillage, and torch accompanied them. The chief cause of the panic was the appearance of the brigantines, which had set sail shortly after

Sandoval’s departure, attended by a large number of Tezcucan canoes[1130] whose object was to coöperate against Iztapalapan. On approaching it the vessels passed close to a steep rocky isle, the Tepepulco, since known as El Peñol del Marqués,[1131] occupied by a large number of fugitives who shouted defiance, and showered stones and arrows. Finding that Sandoval required no aid, Cortés resolved to inflict a lesson on the insolent islanders. The Mexicans appeared confident in the impregnable strength of the rock, and gave so warm a reception to the hundred and fifty men with whom Cortés began to climb it, that fully a score were wounded at the onset. The brigantines turned their guns upon them, however, and under this cover the soldiers speedily gained the summit, there to wreak bloody vengeance. Not a man was spared, only the women and children. “It was a beautiful victory!” exclaims Cortés.

While they were pillaging, a large fleet of canoes, five hundred at the lowest estimate,[1132] was seen to approach from the direction of Mexico, bristling with iztli points, which found a gleaming reflection in the smooth waters of the lake. Cortés ordered an immediate return to the brigantines, and rowed them forward into an extended line. He had longed for an opportunity like this, to meet a formidable fleet upon which the brigantines might inflict a lesson severe enough to open the eyes of the enemy to their invincible power; for “in them lay the key of war,” as he expressed it. Unfortunately the wind was so light as barely to flap the sails. The hostile fleet had already drawn up in good order just beyond range, evidently puzzled at the passive attitude of the monster vessels, yet shouting defiance.[1133] Cortés stood chafing with impatience, for without wind his greatest advantage would be lost, and his position even become precarious. Just then the waters rippled and a breeze came from abaft which speedily freshened. “Ah, God favors us!” he cried, and with a grateful gaze toward heaven he gave orders to advance under full sail. As they came close to the enemy a blinding volley was sent pouring in

upon them from the whole line, from guns, arquebuses, and crossbows, and while the natives were trying to recover from their confusion, from out the smoke burst the ponderous bows, crashing into the lines of canoes, overturning, breaking, and sinking. In the vessels’ wake were wrecks and struggling bodies, while the few canoes which had escaped by passing between the ships struggled to escape the Tezcucan boats in the rear. At the first encounter the canoes in the farther lines turned in hot haste for home, as did a vast number of others which had ventured forth, partly with reënforcements, partly with spectators. But the clumsy-looking vessels sped faster, pursuing their career of destruction for three leagues, into the very canals of the city, whence they turned back to pick up captives. The victory exceeded the wildest hopes of the Spaniards, as Cortés admits, for not only did the Aztecs lose a great number of their foremost warriors and their best canoes, but they surrendered forever to the formidable craft sovereignty over the lake waters, and with it the hope of assistance from trans-lacustrine allies.

Encouraged by this success, Olid advised Alvarado, and both hastened to take advantage of the panic to advance along the causeways and effect considerable execution, impelled as they were with emulation and fresh courage.[1134] Olid had advanced close to Fort Xoloc, which with its stout battlemented walls and towers guarded the junction of the southern causeways, when the brigantines approached it from the eastern side. It was already after vespers; nevertheless Cortés landed to coöperate with his lieutenant and pursue the advantage gained. A breach was made in the wall with one of the heavy guns, and under cover of the fleet’s artillery the place was soon carried. Cortés had intended to make Coyuhuacan his head-quarters, but such were the obvious advantages of Xoloc, in strength and in position, for it lay but half a league from Mexico and was connected in the rear with the mainland by three

causeways, that he at once decided to establish his camp there, making it also his naval station.

Enraged rather than discouraged by the several defeats, Quauhtemotzin ordered a night attack on Xoloc, contrary to native custom. They approached both by sea and land, but owing to their noise they were observed, and driven back by the artillery. The fort was not very strong on the northern side, and the force within was small; but in the morning half of Olid’s troops came to reënforce him, together with fifty of Sandoval’s infantry. The addition was opportune, for the Mexicans were advancing in swarms along the causeway as well as by water, this time on the inner side of the road where the vessels could not reach them. The heavy guns soon cleared a space on the roadway, but as the soldiers pursued they suffered severely from the canoes, which not only showered missiles but afforded retreat for the sallying parties. Orders were accordingly given to cut a passage through the embankment, so that the four brigantines might enter to clear the inner basin. By this means the Spaniards were able to advance to the very entrance of the city and inflict some damage, while the remaining vessels explored the waters beyond, and drove back canoes and fired buildings in the suburbs.

Sandoval at the same time advanced along the causeway from Iztapalapan to Coyuhuacan. It was a league and a half in length, and a quarter of a league from shore it passed through an island town, which was captured and burned. Advised of this, Quauhtemotzin directed a fleet to cut the causeway and entrap the Spaniards; but before long two of the vessels were able to relieve Sandoval, who thereupon left a portion of his troops, including the allies, at Coyuhuacan, and joined his chief with the remainder. Nearly a week was occupied in strengthening Fort Xoloc, arranging the camp, and bringing in supplies, during which time desultory skirmishings were maintained, wherein Sandoval among others received wounds. The brigantines roamed incessantly and inflicted great damage, entering

on one occasion for a long distance a canal which led into the suburbs.[1135] Canoes no longer ventured abroad when a sail was in sight, and the Mexicans began to protect the water approaches and channels with stakes.

In order to complete the investment of the city it was only necessary to occupy the northern causeway to Tepeyacac, along which the besieged maintained a steady intercourse with the mainland. Advised of this neglect by Alvarado, the general ordered Sandoval to form a camp at that town[1136] with one hundred and forty Spaniards, of whom twenty-three were horsemen, and a full proportion of allies. Alvarado had half as many more infantry and a few more cavalry, while two hundred infantry were quartered at Xoloc, supported besides by a cavalry force in the rear, and by Olid’s party, with whom remained the largest proportion of allies, now over eighty thousand, according to Cortés’ own statement. The fort could not hold them, and they accordingly encamped at Coyuhuacan, which lay more convenient for supplies, and must be occupied to watch the hostile shore and lake towns clustered in this quarter. The brigantines carried at least two hundred and fifty men.[1137]

Everything being prepared, Cortés ordered a simultaneous attack from all the camps, so as to divide the attention of the Mexicans and gain all possible advantage. He himself advanced along the Iztapalapan causeway with the greater part of his infantry, attended by several cavaliers on foot, and by over eighty thousand allies, while a vessel skirted the road on either side. There was more than one breach in the road, behind which were posted large forces of warriors protected by intrenchments of earth and masonry.

Without the vessels it would have cost much time and many lives to cross; but the well-directed fire from the guns and arquebuses on the flanks and rear of the enemy soon wrought disorder, which enabled the sallying parties to obtain a foothold. Meanwhile a

number of infantry had swum across the channel and aided to drive the Mexicans beyond the next breach. The same manœuvre was repeated at this and the other chasms, till the army found itself at the very entrance of the city, protected by a wider channel than the preceding, with more extensive fortifications, commanded by a temple tower This with its swarms of slingers and archers made the capture difficult, and the Mexicans also showed more determination; but the guns and fusillade could not be resisted, and soon the Spaniards stood within the city for the first time since the memorable Noche Triste. Revenge seemed already secured, and the lost treasures almost within the invaders’ grasp. Cortés, however, did not permit himself to be carried away by a momentary success. He saw the main street beyond thronged with warriors fiercely bent on resistance, streets as far as the distant temple of the war-god bordered with buildings, each a fortress in itself, while many a barricaded channel blocked the way.

A large force of allies had been left to fill the chasm and level the ground as the army advanced, using for this purpose the captured intrenchments and buildings, or even material from the causeway itself. This work was under the direction of Diego Hernandez, a man of herculean strength, who could throw a stone with a force and precision, it was said, approximating those of cannon.[1138] This filling of the chasms enabled the horses to be brought forward, and they now led the charge against the dense masses of natives, after the arquebuses had effected the preliminary clearing. Cortés had not underestimated the annoyance to be encountered from the archers and slingers covering the roofs on either side; but the operations of the cavalry left the many arquebusiers and cross-bowmen at liberty to cover the points of approach through which the allies in particular poured in countless numbers with sidearms and fire-brands. The progress so far had surpassed all anticipation; but now the Spaniards came to a canal from which the retreating Mexicans

removed the few planks remaining of the bridge, leaving a solitary beam. Here the warriors were massed in greater confidence, free as they were from the attack of vessels and sheltered by strong intrenchments, while the adjoining roofs, equally protected by the canals, teemed with missile-throwers. The soldiers tried again and again to cross the chasm, only to be driven back with injury The volleys from cross-bows and fire-arms could effect but little damage against the well sheltered warriors, while their arrows and stones came in rattling showers. Finally two cannon were brought forward. This changed the issue, for a breach was speedily made in the intrenchments, and now the small-arms were able to coöperate with great execution.

After a delay of two hours the soldiers were across; and while the allies filled the canal they again pursued their advance along the avenue, though suffering considerably from the roof missiles. They now came to the last channel in the street, close to the main plaza, wherein stood the famous temple of Huitzilopochtli.

The advance of the Spaniards had been so unexpected and rapid that the Mexicans had not thought of fortifying this canal, and little difficulty was met in crossing. But beyond, the plaza was filled with files of defenders, determined to save their deities and that sacred ground. Greatly frightened, the priests cried out to them: “Behold! it was here upon this spot you fought these beings infernal before, and drove them forth in shameful flight; the gods will help you again!” Even the Spanish soldiers were impressed by the words and gestures of the frantic devotees, and noted their effect in the gleaming eyes and pressed lips of the warriors, and they paused. But presently a gun was brought forward and directed against the packed throng. This effected a backward movement. “There is no time for rest or fear!” shouted Cortés, as with shield in hand he rushed forward. With a thundering Santiago the soldiers followed. The charge was irresistible, and already startled by the mowing

cannon-balls the Mexicans took refuge within the temple enclosure and in the by-streets.

The Spaniards followed the crowd within the sacred grounds, slashing and thrusting. It seemed a repetition of Alvarado’s massacre, and the war-god, thirsting for blood, might now have his fill. In a few moments not a warrior was left round the temple, only prostrate bodies. Then the soldiers prepared to ascend the pyramid to hurl down the idol and its defenders. But the deity was aroused. The sombre notes of the sacred drum struck their fearful appeal on every heart, “Rouse ye to your imperilled hearths and temples!” It was but now the Mexicans observed that the death-dealing horsemen were not present, for the last channel had not yet been filled to afford a crossing. This lent them courage, and on the foe they quickly rushed from lanes and houses, while down from the temple-top came a doubly inspired avalanche. The shock was overwhelming. The Spaniards were forced to retire, partly in disorder. Cortés made frantic efforts to stay the flight, and at the gate a momentary rally was made by a few; but what availed that handful against the torrent sweeping onward, headed by the renowned band of Quauhtin? Perforce they must yield and join the troops which were in such hasty flight from the plaza that they even abandoned the cannon. Cortés was on foot in the crowd, and his voice was drowned in the tumult. He could but follow with the wild current, which threatened to lead into another disaster. Just then cries of alarm burst from the crowds on the roofs, and there was a lull in the shower of stones and darts, and the pressure of pursuers relaxed. The next moment the ears of the wandering Spaniards caught the clatter of hoofs.

The cavalry had come up; a revulsion set in. They were but a few,[1139] but enough to bring back to the minds of the Mexicans their original and ever present fear of the monsters, for they knew not how many might be coming down upon them.

The infantry followed the horsemen with inspiring cheers, and bore unresisted onward, for the late bravery of the foe was now turned to cowardice. Before long the Spaniards had penetrated through the plaza and occupied once more the temple court. Once more their looks were upward toward the summit of the lofty pyramid consecrated during their former occupation to the holy virgin; and while the main portion of the troops fought the now rallying Mexicans, a sturdy handful undertook the capture of the sanctuary. A dozen chiefs held possession, but naught could stay the fury of the soldiers, and in a few moments the last defender had yielded his spirit in defense of his faith.

The Spaniards looked in vain for any trace of their own altar and symbols, round which they had so oft congregated in prayer. In their stead rose a new idol glittering with ornaments and hideous with devices, while fresh stains of blood spread horror over all. The gleam of gold proved all absorbing, however, and hastily the jewels and the golden mask were torn away, and then the head of the idol was struck off and sent clattering below.[1140]

There was time for nothing more, for on finding so few horsemen present, the Quauhtin knights had again made an effective rally, pressing the troops closely Fortunately a larger force of cavalry came up again to turn the tide of battle and inflict a severe lesson. As it was late by this time, there remained no choice but that of returning to camp. This movement gave fresh confidence to the Mexicans, who followed in swarms, harassing from roofs and lanes, on front and flanks, rushing forward with renewed fury after every charge by the cavalry which covered the rear. But for the horses the soldiers would have suffered severely; as it was, the retreat proceeded in good order, and as many houses as possible were fired with a view to make the next entry safer. On approaching the causeway the canoe crews, composed of selected warriors, fell on the flanks and created no little confusion before they were driven

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.