rhyz
03-12-2009, 11:28 AM
hi first post dunno if it is in the right place
i use javascript to create a cookie when you click a link
<a href="#" onclick="document.cookie='settings=blue; expires=31/03/2009;'">Blue</a>
this creates a cookie and i can get it back easily
but i want to use it as settings
i have 3 folders of pictures white blue and pink the user will click the link selecting there colour creating a cookie
now when the page finds the cookie it needs to place the output in to the path.
<img src="pictures/ !!!output!!! /something.png">
so far i have this (just a trial)
<script type="text/javascript" src="cookie.js">
</script>
<script type="text/javascript">
function image()
{
settings=getCookie('settings');
if (settings!=null && settings!="")
{
document.write('<img src="'+settings+'.png">')
}
}
document.write(image())
</script>
this works but next to the image it says undefined so how would i get rid of it?
and i was wondering if there was a better way to do it??
THANKS :thumbsup:
i use javascript to create a cookie when you click a link
<a href="#" onclick="document.cookie='settings=blue; expires=31/03/2009;'">Blue</a>
this creates a cookie and i can get it back easily
but i want to use it as settings
i have 3 folders of pictures white blue and pink the user will click the link selecting there colour creating a cookie
now when the page finds the cookie it needs to place the output in to the path.
<img src="pictures/ !!!output!!! /something.png">
so far i have this (just a trial)
<script type="text/javascript" src="cookie.js">
</script>
<script type="text/javascript">
function image()
{
settings=getCookie('settings');
if (settings!=null && settings!="")
{
document.write('<img src="'+settings+'.png">')
}
}
document.write(image())
</script>
this works but next to the image it says undefined so how would i get rid of it?
and i was wondering if there was a better way to do it??
THANKS :thumbsup: