javascript localstorage
<p>So, here's my code:</p>

<pre><code>localStorage.setItem("nhac",for(p=0;p&lt;opener.document.getElementsByName('link').length;p++){opener.document.getElementsByName('link').item(p).style.backgroundColor})
</code></pre>

<p>I'm so confused i can't think anymore xD, I've been trying all day long to make this work, i can't even explain it,sorry.
I have a popup which i opened from the main page. From the pop up window, im retrieving the elements from which i want to save the background-color so, by saving it in localstorage, it will always remain like that.
I've done others that work well, like this</p>

<pre><code>localStorage.setItem("color_chosen2", opener.document.getElementById('header').style.color);
</code></pre>

<p>I don't know why it doesn't work, can anyone help me? It gives me some kind of error( the first one)</p>

<p>thanks</p>

<p>Edit:(sorry, I was in a hurry when i posted this)
 The error it gives is "SyntaxError: syntax error"
(I'm using firefox, by the way)
Using the javascript console, this code</p>

<pre><code>for(p=0;p&lt;opener.document.getElementsByName('link').length;p++){opener.document.getElementsByName('link').item(p).style.backgroundColor}
</code></pre>

<p>returns the background color of the elements perfectly, but when I try to use it as the value in localStorage , it gives an error.
And no, there's no problem with the syntax <code>localStorage.setItem</code>, it's how it is, thanks.</p>

<p>Edit2: if you need to see how it works better, here's my <a href="http://www.varquilha.webs.com/" rel="nofollow" title="website">website</a>. the pop-up opens from the link in the bottom center.</p>
