There is an error in the code. If you compare the code at the bottom of the page
(password1.value != password2.value)
to the download code and the code for this section as written on page 540 you'll find that the DL code and page 540 use
(password1 != password2)
You'll find that the first approach simply doesn't work, probably because it doesn't use valid variable names, but the second does.
BTW, have you noticed that the download code for ch12_eg02 doesn't work as far as comparing the passwords? In other words, you can enter any letters you want in "password" and "confirm password" and it will submit as long as they're longer than six characters.