Unable to identify error in JavaScript code
<p>I am learning JavaScript from the book DOM Scripting. The following code is not working:</p>

<pre><code>window.onload = prepareLinks;

function prepareLinks() {
    var links = document.getElementsByTagName("a");
    for (var i = 0; i &lt; links.length; i++) {
        if (links[i].getAttribute("class") == "popup") {
            links[i].onclick = function () {
                popUp(this.getAttribute("href"));
                return false;
            }
        }
    }
}

function popUp(winURL) {
    window.open(winURL, "popup", "width=320, height=480");
}
</code></pre>

<p>Can anybody tell me what the problem is with the code?</p>
