# Create a cookie to handle java:function();

**URL:** <https://forum.kirupa.com/t/create-a-cookie-to-handle-java-function/202603>\
**Category:** programming\
**Created:** [October 3, 2006, 12:04am UTC](https://forum.kirupa.com/t/create-a-cookie-to-handle-java-function/202603 "2006-10-03T00:04:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brndn](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brndn](https://forum.kirupa.com/u/brndn)\
**Post date:** [October 3, 2006, 12:04am UTC](https://forum.kirupa.com/t/create-a-cookie-to-handle-java-function/202603/1 "2006-10-03T00:04:25Z")

</div>

Is it doable to use javascript functions to set a cookie parameter  
and call the function if the cookie is detected?

heres the javascript that changes the background attribute.

```auto
<script language="javascript" type="text/javascript">

function Blacker(){
document.getElementById('background_colour').style.background="#000000";
}
function Blacker2(){
document.getElementById('background_colour').style.background="#333333";
}
function Blacker3(){
document.getElementById('background_colour').style.background="#666666";
}
</script>
</head>

<body id="background_colour" style="background:#000000;">
<a href="javascript:Blacker()">adasdasdasdasada</a><br>
<a href="javascript:Blacker2()">adasdasdasdasada</a><br>
<a href="javascript:Blacker3()">adasdasdasdasada</a>
</body>

```

Can I store this data in acookie so when the user goes to the next page it automatically remembers the colour they have selected??

if this makes any sense
