Argument 1 of Node.appendChild does not implement interface Node. while appending to new element
<p>HI i am a newbie to web development.</p>

<p>i am getting above error. i want to attach href attribute tag to image tag and my code is</p>

<pre><code>function linkus()
    {
        var a= document.getElementsByTagName("img");
        var b=document.createElement("a");
        b.href="";
        b.rel="prettyPhoto";
        b.appendChild(a[0]);
    }
</code></pre>

<p>any help please...</p>