这里是将javascript数组转换为php数组的代码.....这是用cookies完成的...
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
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 checkCookie()
{
var a_php = "";
var a=new Array();
/*
a[0]="Saab";
a[1]="Volvo";
a[2]="BMW";
a[3]="sample"
a[4]="Saab";
a[5]="Volvo";
a[6]="BMW";
a[7]="sample"
a[8]="Saab";
a[9]="Volvo";
a[10]="BMW";
a[11]="sample"
a[12]="Saab";
a[13]="Volvo";
a[14]="BMW";
a[15]="sample"
a[16]="Saab";
a[17]="Volvo";
a[18]="BMW";
a[19]="sample"
a[20]="Saab";
a[21]="Volvo";
a[22]="BMW";
a[23]="sample"
a[24]="Saab"; …Run Code Online (Sandbox Code Playgroud)