Jump to content

Cookies save and remember selecting background (Blogger)


gtafiles

Recommended Posts

1° - Sorry my English, I'm using Google translator. Hello, I'm trying to create a tool to change the background color of the site (blogger), but the way it did, it does not save the option of the visitor, every time the visitor has to click on the color. What code could I use to save cookies, or this way is impossible? See the code I'm using:

<center><a href="#" onclick="javascript:document.body.style.backgroundColor='#59141b';"><img src="http://4.bp.blogspot.com/_dsEG33PDaHw/S32TTX4H60I/AAAAAAAAAJU/qYc4BYZclgg/s200/body-rojo.png" /></a><a href="#" onclick="javascript:document.body.style.backgroundColor='#1d2d05'; document.body.style.backgroundImage='http://1.bp.blogspot.com/-j5vpiqnwsd8/t_7bvccefoi/aaaaaaaae0g/wfkeypr5jm8/s1600/testelow.jpg';"><img src="http://2.bp.blogspot.com/_dsEG33PDaHw/S32TTyfDggI/AAAAAAAAAJk/9x17-Ec7Dnw/s200/body-verde.png" /></a><a href="#" onclick="javascript:document.body.style.backgroundColor='#15435a'; document.body.style.backgroundImage='http://1.bp.blogspot.com/-j5vpiqnwsd8/t_7bvccefoi/aaaaaaaae0g/wfkeypr5jm8/s1600/testelow.jpg';"><img src="http://4.bp.blogspot.com/_dsEG33PDaHw/S32TLXeztWI/AAAAAAAAAI0/7hWfrfWsdKU/s200/body-azul.png" /></a>  <a href="#" onclick="javascript:document.body.style.backgroundColor='#222'; document.body.style.backgroundImage='http://1.bp.blogspot.com/-j5vpiqnwsd8/t_7bvccefoi/aaaaaaaae0g/wfkeypr5jm8/s1600/testelow.jpg';"><img src="http://2.bp.blogspot.com/_dsEG33PDaHw/S32TMY3FA9I/AAAAAAAAAJM/6Hx0CAagVOQ/s200/body-negro.png" /></a></center>

Link to comment
Share on other sites

Instead of having the code inline in the event handler you should write a function that changes the color and sets the value in a cookie. Each event handler can call the function and pass the color to it. When the page loads you need another function that checks for the cookie and sets the color if the cookie is there.

Link to comment
Share on other sites

Instead of having the code inline in the event handler you should write a function that changes the color and sets the value in a cookie. Each event handler can call the function and pass the color to it. When the page loads you need another function that checks for the cookie and sets the color if the cookie is there.
This is possible in Blogger?
Link to comment
Share on other sites

We're here to help people learn, we're happy to help you learn how to do this but we're not going to do it for you. If you want something that works like it does on that site, you can view the source code of that to see their Javascript code that does it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...