Jump to content
Sign in to follow this  
gtafiles

Cookies save and remember selecting background (Blogger)

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>

Share this post


Link to post
Share on other sites

where are you using the cookies? or are you asking how to implement cookies?

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

I don't use Blogger. All it requires is Javascript code. If you can add Javascript code to your files then you should be able to do this.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...