var newText = "<h1>You are now looking at page " + this.thisPage + ".<\/h1>";
var contentWin = parent.document.getElementById("content"). contentWindow;
contentWin.document.body.innerHTML = newText;
Here is the meat of the
writeContent() function, which first declares and sets a variable,
newText, and assigns it some text. Next, the
contentWin variable is set, as shown earlier in this chapter in Script 5.6, and then we reset
contentWin.document.body.innerHTML to
newText. To explain this a bit further, given
contentWin, we want the
document it contains; then we get the
body of that
document, and then we reset
innerHTML, which is the HTML contained
within that tag.
No comments:
Post a Comment