Changing JS code from clicking image to clicking link
<p>I found the following JS online, which functions like:</p>

<p>If an image is clicked, open the image in new window and prompt for print. Once printed the window closes. I need this script modified to click a print link it prints an image then closes the new image window. So I want to change from clicking the image itself to clicking a link that says print image.</p>

<p>Here is the code: </p>

<pre><code>    &lt;script type="text/javascript"&gt;
/* &lt;![CDATA[ */

function makepage(src)
{
  // We break the closing script tag in half to prevent
  // the HTML parser from seeing it as a part of
  // the *main* page.

  return "&lt;html&gt;\n" +
    "&lt;head&gt;\n" +
    "&lt;title&gt;Temporary Printing Window&lt;/title&gt;\n" +
    "&lt;script&gt;\n" +
    "function step1() {\n" +
    "  setTimeout('step2()', 10);\n" +
    "}\n" +
    "function step2() {\n" +
    "  window.print();\n" +
    "  window.close();\n" +
    "}\n" +
    "&lt;/scr" + "ipt&gt;\n" +
    "&lt;/head&gt;\n" +
    "&lt;body onLoad='step1()'&gt;\n" +
    "&lt;img src='" + src + "'/&gt;\n" +
    "&lt;/body&gt;\n" +
    "&lt;/html&gt;\n";
}

function printme(evt)
{
  if (!evt) {
    // Old IE
    evt = window.event;
  }    
  var image = evt.target;
  if (!image) {
    // Old IE
    image = window.event.srcElement;
  }
  src = image.src;
  link = "about:blank";
  var pw = window.open(link, "_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}

/* ]]&gt; */
&lt;/script&gt;
</code></pre>

<hr>

<pre><code>&lt;img src="fortune.jpg" onclick="printme(event)" /&gt;
</code></pre>

<p>I do not know any JS so I apologize. I only do php/mysql. 
Best Regards!
Jim.</p>
