Unable to display image using javascript
<p>net code as follows</p>

<pre><code>&lt;asp:Image runat="server" ID="img1" ImageUrl="~/Images/important.gif" /&gt;
    &lt;asp:Button ID="btn" runat="server" Text="print" /&gt;
</code></pre>

<p>and my javascript is as follows</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function printIt() {
        var win = window.open('', 'Image', 'resizable=yes,...');
        if (win) {
            //var imgID = '&lt;%= img1.ClientID %&gt;';
            var imageControl = document.getElementById('&lt;%=img1.ClientID%&gt;').src;
            win.document.write(imageControl);
            win.document.close();
            win.focus();
            win.print();
        }
        return false;
    }
&lt;/script&gt;
</code></pre>

<p>// updated code as per <code>vitoshabg</code> answer</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function printIt() {
        var win = window.open('', 'Image', 'resizable=yes,...');
        if (win) {
            //var imgID = '&lt;%= img1.ClientID %&gt;';
            var imageControl = document.getElementById('&lt;%=img1.ClientID%&gt;').src;
            win.write('&lt;img src="' + imageControl + '"&gt;');
            //win.write(imgParent);
            win.document.close();
            win.focus();
            win.print();
        }
        return false;
    }
&lt;/script&gt;
</code></pre>

<p>But instead of the image I am getting the url can some one help me to get the image here</p>
