Format string in an insertRule javascript statement
<p>I am looking to change the :hover style of a nav element through Javascript using insertRule. The background color of the nav link will change based on bgndImgIndex. Is this possible with Javascript or am I just plain wrong?</p>

<pre><code>var bgndImgIndex = 0;
var colorSelect = ['#ffa800', '#ba2a2a', '#5ad339'];

var sheet = document.styleSheets[0];

sheet.insertRule("a:hover {background:{0} !important".format(colorSelect[bgndImgIndex]), 4);
</code></pre>