Hello ive been getting an error creating a simple cookie and i have no idea why… heres my sample code.
<script type=”text/javascript”>
function saveIt()
{
var x = prompt(“Enter value”);
if (!x)
alert(‘Please fill in a value in the input box.’);
else
{
alert(‘entered’);
setCookie(‘abcdefo’,x);
alert(‘Cookie created’);
}
}
</script>
and saveIt() is called via…
<a href=”javascript:saveIt()”>Create cookie 1</a>
i realise this is terrible code practicing as im not even checking if the cookie already exists but in this case i know it doesnt therefore i dont understand the error. perhaps my syntax is messed somewhere and i just cant see it. also, when i enter a value it does get to the alert(‘entered’); so it crashes on the setCookie.. i have no idea whats wrong