gtafiles Posted July 19, 2012 Share Posted July 19, 2012 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 More sharing options...
thescientist Posted July 19, 2012 Share Posted July 19, 2012 where are you using the cookies? or are you asking how to implement cookies? Link to comment Share on other sites More sharing options...
gtafiles Posted July 19, 2012 Author Share Posted July 19, 2012 I wonder how implement cookies of the selection of the background. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 19, 2012 Share Posted July 19, 2012 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 More sharing options...
gtafiles Posted July 19, 2012 Author Share Posted July 19, 2012 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 More sharing options...
justsomeguy Posted July 19, 2012 Share Posted July 19, 2012 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. Link to comment Share on other sites More sharing options...
gtafiles Posted July 19, 2012 Author Share Posted July 19, 2012 Hm, but actually i know nothing about Javascript, I came here to see if anyone has any idea how to do this. I wanted to do something like: http://www.clearviewarts.com/cookiebgi.html Link to comment Share on other sites More sharing options...
justsomeguy Posted July 19, 2012 Share Posted July 19, 2012 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 More sharing options...
gtafiles Posted July 19, 2012 Author Share Posted July 19, 2012 ok, thanks for atention, i fix it, but takes a while to remember the cookie, but ta cool :)see how it went: www.gtafiles.net sorry if I can not disclose sites. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now