Hey all. I’m new here. I’ve just started trying to use javascript and cookies to build myself a shopping cart/checkout system. Just playing with cookies and forms at the moment without much luck. Would anyone be able to give me a few tips on this code? The bolded/underlined sections are the parts i’m having problems with.
Any hints/tips would be much appreciated! This is frustrating stuff!
[CODE]<html>
<head>
<title>Cookie Example</title>
<script language=”javascript”>
<!–
expiry = new Date();
expiry.setMonth(expiry.getMonth()+1);
function setCookie(c_name,c_value)
{
document.cookie = c_name + “=” + c_value + “;expires=” + expiry.toGMTString();
}
//–>
</script>
</head>
<body leftmargin=”50″>
<form>
Select products
<p />
Product 1: <input type=”checkbox” name=”prouduct1″ [U][B]onChange=”Store info until button is pressed”>[/B][/U]
<br />
Product 2: <input type=”checkbox” name=”prouduct2″ [U][B]onChange=”Store info until button is pressed”>[/B][/U]
<p />
<input type=”button” value=”set cookie!” onClick=”javascript:setCookie[U][B](Info from checkboxes.. I.e. product1, product2, product3)[/B]”>[/U]
</form>
</body>
</html>