Run a function in the background .js file from the popup .html file in a Chrome extension
<p>I am trying to write a Chrome extension. You switch between icons by clicking the Chrome extension icon, and the popup.html comes up with a preview of the icon you will set it to by clicking:</p>

<pre><code>&lt;input type="image" src="icon.png" onclick="helloWorld()"&gt;&lt;/input&gt;
</code></pre>

<p>And the function <code>helloWorld()</code> is defined in the background.js file (same directory:</p>

<pre><code>chrome.browserAction.setIcon({
  path : "/iconcat.png"
});

function helloWorld() {
    chrome.browserAction.setIcon({
      path : "/icon.png"
    });
}
</code></pre>

<p>(the first thing that is being done is setting it to a cat icon)</p>

<p>I have both <code>icon.png</code> and <code>iconcat.png</code> in the same directory as each other and the .html and .js files.</p>

<p>How can I get the image button to run the <code>helloWorld()</code> function in the .js file by clicking it?</p>