Forums

This topic is locked

Extract loads of data from cookie

Posted 06 May 2005 22:58:14
1
has voted
06 May 2005 22:58:14 nick kougar posted:
Newbie to javascript need urgently help...
I have a cookie with lots of data inside (taken from a form).. Data is writen in that way :
========
document.cookie="HEWLETT PACKARD = " + quant01 + "|" + "EMACHINES 5210R = " + quant02 + "|" + "COMPAQ_Rosartoa = "+
quant03 + "|" + "XP_PACKARD BELL = " + quant04 + "|" + "XP_PACKARD BELL PBVT = " + quant05 + "|" + "Subtotal of HP = " +
(quant01*899.99) + "|" + "Subtotal of EM = " + (quant02*399.99) + "|" + "Subtotal of CR = " + (quant03*599.99) + "|" +
"Subtotal of PB = " + (quant04*399.99) + "|" + "Subtotal of PBVT = " + (quant05*829.99) + "|" + "Total Desktops=" + totalion +
"Warranty Total = " + txt + "|" + outvar + ";expires=" +expire.toGMTString()
============
I'm trying to extract it using the split method with this lines:
==========
var cookie_stuff = document.cookie;
values_data=cookie_stuff.split("|"
//for(i=0; i<(cookieArray.length); i= i+4)
for (var loop=0;loop<values_data.length; loop= loop +4)
{


document.write("<tr>"
document.write("<td width=200>" + values_data[loop].split("=" + "</td>"
document.write("<td width=80>" + values_data[loop+1].split("=" + "</td>"
document.write("<td><input class=greytext type=text size=1 value=" + values_data[loop+2].split("=" + ">" + "</td>"
document.write("<td width=60>" + values_data[loop+3].split("=" + "</td>"
document.write("<td class=greytext><input type=submit value='remove'></td>"
document.write("<td><input class=greytext type=submit value='update'></td>"

}
==================
BUT THEY DONT SEEM TO DO THE JOB ...AAAAAAAARGHHHHHH...

Could anybody help me in sorting out this mess of data into proper table cells?

Thanks in advance for your help<b></b>

Reply to this topic