这是我正在尝试为表单中的复选框设置 cookie 的功能
function setCookie(c_name,value,exdays){
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ?
"" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function set_check(){
var proceed = document.forms['form1']['proceed_opt[]'].checked;
setCookie(proceed_opt[], proceed, 60*60*1);
alert(proceed_opt[]);
}
我表单中的复选框是这样的..
<input type="checkbox" name="proceed_opt[]" value="I will upload new Image" onChange="set_check()";>
Insert Option "I will upload new Image"
</td>
</tr>
<tr>
<td></td>
<td colspan="2">
<input type="checkbox" name="proceed_opt[]" value="I approve this sample for a Night Light" onChange="set_check()";>
Insert Option "<font face="Arial, Helvetica, sans-serif" size="2">I approve this sample for a Night Light</font>"
</td>
</tr>
<tr>
<td></td>
<td colspan="2">
<input type="checkbox" name="proceed_opt[]" value="Select One" onChange="set_check()";>
Insert Option "<font face="Arial, Helvetica, sans-serif" size="2">Select One</font>"
</td>
</tr>
<tr>
<td></td>
<td colspan='2'>
<input type="checkbox" name="proceed_opt[]" value="other" onChange="set_check()">
Insert Option "Other See comments"
</td>
</tr>
但是这里没有设置cookies...谁能告诉我如何为表单中的复选框设置cookies...