473,472 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make Bgcolor changer save choice using cookies?

mardash
10 New Member
Expand|Select|Wrap|Line Numbers
  1. <div style="cursor: pointer; opacity: 1; position: fixed; right: 10px; top: 5px;">
  2.  
  3.  
  4. <script type="text/javascript">
  5. function bgChange(bg)
  6. {
  7. document.body.style.background=bg;
  8. }
  9. </script>
  10. <table border="1" height="20" style="width: 300px;"><tbody>
  11. <tr> <td bgcolor="white" onclick="bgChange('')">
  12. </td><td bgcolor="#699AB8" onclick="bgChange('#699AB8')">
  13. </td><td bgcolor="#000000" onclick="bgChange('#000000')">
  14. </td><td bgcolor="#FF00FF" onclick="bgChange('#FF00FF')">
  15. </td><td bgcolor="#006400" onclick="bgChange('#006400')">
  16. </td><td bgcolor="#FF6600" onclick="bgChange('#FF6600')">
  17. </td><td bgcolor="#480082" onclick="bgChange('#480082')">
  18. </td><td bgcolor="#dc143c" onclick="bgChange('#dc143c')">
  19. </td><td bgcolor="#D4E3EA" onclick="bgChange('#D4E3EA')">
  20. </td><td bgcolor="#B40404" onclick="bgChange('#B40404')">
  21. </td><td bgcolor="#9A2EFE" onclick="bgChange('#9A2EFE')">
  22. </td><td bgcolor="#236c95" onclick="bgChange('#236c95')">
  23.  
  24.  
  25. </td></tr>
  26. </tbody></table>
  27. </div>

this's Background Color Changer .. but it no save visitor choice .. if i choosed red color .. it's ok .. but when i refresh i no see red color .. i see original one again .. So ..

How to make Bgcolor changer save choice usig cockies ??
Apr 16 '12 #1
5 2043
Dormilich
8,658 Recognized Expert Moderator Expert
for java cookies you’d need Java (that’s actually a different language), but I’m not sure whether Java applet have their own cookies …

however you have the choice to store data in regular cookies or the new Web Storage using JavaScript.
Apr 16 '12 #2
mardash
10 New Member
Sp what java i add now to make it save cockies ?
Apr 16 '12 #3
Dormilich
8,658 Recognized Expert Moderator Expert
I don’t know Java. this is the JavaScript forum.
Apr 16 '12 #4
mardash
10 New Member
can you help me with javascript cockies to do save color ?
Apr 17 '12 #5
Dormilich
8,658 Recognized Expert Moderator Expert
I haven’t used cookies for a while but IIRC setting data works by
Expand|Select|Wrap|Line Numbers
  1. document.cookie = "key=value";
reading is a bit more complicated as you get all key-value pairs as string. [more info]
Apr 17 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
3
by: Robert Bralic | last post by:
Hello, I writed small graphical editor for probabilystic networks in JAVA, but there was problem with making save file inJAVA. I thinked about it and I concluded that Save in JAVA is great...
2
by: JohnK | last post by:
Hi all, This is my first time visiting this group. I already tried two other java groups, but those aren't very populated. I don't know if it is the right one, otherwise please tell me in which...
5
by: Morpth | last post by:
I'm headed back to school to retool. I have enrolled into a .NET programming certificate program. We have a choice of Java or Visual Basic on the .NET platform. Of course its not described this...
1
by: George Raetz | last post by:
Greetings, I open the "Northwind" sample data base in Access 2003. In the "Orders" form there is a "CustomerID" combobox labeled "Bill To". I scroll thru the list in the combobox and make a...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
0
by: vidhyasreddy | last post by:
Hi All, While we are Localizing our product we faced below problem: java.awt components not able to display some non-english charecters like \u2019 , \u2018 , \u2026 , \u2013 , \u8230 . ...
18
by: julietbrown | last post by:
Can you boost my understanding of Access? I don't like things I can 'cure' but don't understand why! I've converted the Save macro on my form to VBA. It looks like this ... as I'm sure you...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.