So, here's my code:
localStorage.setItem("nhac",for(p=0;p<opener.document.getElementsByName('link').length;p++){opener.document.getElementsByName('link').item(p).style.backgroundColor})
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
localStorage.setItem("color_chosen2", opener.document.getElementById('header').style.color);
I don't know why it doesn't work, can anyone help me? It gives me some kind of error( the first one)
thanks
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
for(p=0;p<opener.document.getElementsByName('link').length;p++){opener.document.getElementsByName('link').item(p).style.backgroundColor}
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 localStorage.setItem, it's how it is, thanks.
Edit2: if you need to see how it works better, here's my website. the pop-up opens from the link in the bottom center.