I am trying to pass three pieces of data to a cookie then the page is changed and a new item is added to the basket i want to up-date the data in the cookie. does any one have any idears
< ! D O C T Y P E H T M L P U B L I C " - / / W 3 C / / D T D H T M L 4 . 0 T r a n s i t i o n a l / / E N " >
< H T M L >
< H E A D >
< T I T L E > N e w D o c u m e n t < / T I T L E >
< S C R I P T L A N G U A G E = " J a v a S c r i p t " >
< ! - -
v a r t o t a l C o s t P e r I t e m = " " ;
f u n c t i o n p r o c e s s ( ) {
v a r i t e m D e s = d o c u m e n t . f o r m 1 . p r o d u c t . v a l u e ;
v a r c o s t = d o c u m e n t . f o r m 1 . p r i c e . v a l u e ;
v a r n u m b e r R e q = d o c u m e n t . f o r m 1 . n o R e q u i r e d . v a l u e ;
v a r c o o k i e _ D a t a = " : " + i t e m D e s + " " + c o s t + " " + n u m b e r R e q + " : " ;
v a r o u t _ C o o k i e _ D a t a = u n e s c a p e ( d o c u m e n t . c o o k i e ) ;
v a r c r u m b s = o u t _ C o o k i e _ D a t a . s p l i t ( " : " )
f o r ( i = 0 ; i < c r u m b s . l e n g t h ; i = i + 3 )
{
v a r j = 0 ;
f o r ( j = 0 ; j < 3 ; j + + )
{
c r u m b s [ i ] [ j ] = c r u m b s [ i + j ]
a l e r t ( c r u m b s [ i + j ] )
}
}
}
- - >
< / S C R I P T >
< / H E A D >
< B O D Y >
< F O R M M E T H O D = P O S T A C T I O N = " # " n a m e = " f o r m 1 " >
< I N P U T T Y P E = " h i d d e n " v a l u e = " u n i x " n a m e = " p r o d u c t " >
< I N P U T T Y P E = " h i d d e n " v a l u e = " 3 0 . 0 0 " n a m e = " p r i c e " >
< i n p u t t y p e = " h i d d e n " v a l u e = " " n a m e = " r u n n i n g T o t a l " >
< p > a m m o u n t r e q u i r e < I N P U T T Y P E = " i n p u t " v a l u e = " " n a m e = " n o R e q u i r e d " s i z e = " 5 " >
< I N P U T T Y P E = " s u b m i t " o n C l i c k = " p r o c e s s ( ) " >
< / F O R M >
< / B O D Y >
< / H T M L >
< ! D O C T Y P E H T M L P U B L I C " - / / W 3 C / / D T D H T M L 4 . 0 T r a n s i t i o n a l / / E N " >
< H T M L >
< H E A D >
< T I T L E > N e w D o c u m e n t < / T I T L E >
< S C R I P T L A N G U A G E = " J a v a S c r i p t " >
< ! - -
v a r t o t a l C o s t P e r I t e m = " " ;
f u n c t i o n p r o c e s s ( ) {
v a r i t e m D e s = d o c u m e n t . f o r m 1 . p r o d u c t . v a l u e ;
v a r c o s t = d o c u m e n t . f o r m 1 . p r i c e . v a l u e ;
v a r n u m b e r R e q = d o c u m e n t . f o r m 1 . n o R e q u i r e d . v a l u e ;
v a r c o o k i e _ D a t a = " : " + i t e m D e s + " " + c o s t + " " + n u m b e r R e q + " : " ;
v a r o u t _ C o o k i e _ D a t a = u n e s c a p e ( d o c u m e n t . c o o k i e ) ;
v a r c r u m b s = o u t _ C o o k i e _ D a t a . s p l i t ( " : " )
f o r ( i = 0 ; i < c r u m b s . l e n g t h ; i = i + 3 )
{
v a r j = 0 ;
f o r ( j = 0 ; j < 3 ; j + + )
{
c r u m b s [ i ] [ j ] = c r u m b s [ i + j ]
a l e r t ( c r u m b s [ i + j ] )
}
}
}
- - >
< / S C R I P T >
< / H E A D >
< B O D Y >
< F O R M M E T H O D = P O S T A C T I O N = " # " n a m e = " f o r m 1 " >
< I N P U T T Y P E = " h i d d e n " v a l u e = " u n i x " n a m e = " p r o d u c t " >
< I N P U T T Y P E = " h i d d e n " v a l u e = " 3 0 . 0 0 " n a m e = " p r i c e " >
< i n p u t t y p e = " h i d d e n " v a l u e = " " n a m e = " r u n n i n g T o t a l " >
< p > a m m o u n t r e q u i r e < I N P U T T Y P E = " i n p u t " v a l u e = " " n a m e = " n o R e q u i r e d " s i z e = " 5 " >
< I N P U T T Y P E = " s u b m i t " o n C l i c k = " p r o c e s s ( ) " >
< / F O R M >
< / B O D Y >
< / H T M L >