You're seeing this behavior because of the markup. According to the HTML specification, an HTML document should have only one head element and one body element. Since you have two body elements, the browser uses the first body element and ignores the second element (but not it's content--in fact, the second element's content is appended to the first body). Because the second body element is ignored, the document's background doesn't change to yellow.
The same behavior is exhibited in the title elements. Your document has three head elements with three title elements. The browser uses the first title element and ignores the second and third.
To give you an idea of what the book was meaning, use this code:
document.bgColor = "red";
document.bgColor = "yellow";