Hi Imar:
Thank you for your help I will check it.
Cheers
Kahine
>From: "Imar Spaanjaars" <Imar@S...>
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] Re: Problems with Cookie
>Date: Sat, 8 Sep 2001 08:56:53
>
>Hi Kahine,
>
>Not sure whether this happened when copy & pastin' your code but it seems
>that all your functions are setup incorrectly. They miss the closing }
>
>A function should be defined like this:
>
>function functionName(){
> // code here
>
>}
>
>
>A couple of you functions lack the }, therefore causing errors, I guess.
>
>Hope this helps,
>
>Imar
>
>
>
>
> > Hi!
> >
> > I have a page named Cart which loads two html pages called Catalog and
> > Total.
> > The Catalog page have 6 forms named
> > Product 1, Product 2, until Product 6
> > Each form have text fields and a select field
> >
> > Then the Total Page have a form calles OrderForm
> > This form have text fields and a radio button
> >
> > I'm trying to store the information of this selection into a cookie. I
>had
> > already developed a cookie but this cookie could not store any
>information
> > and when the page is loaded it gives me an error.
> >
> > I'm attaching the cookie script maybe there is an error.
> >
> > <script language="Javascript"><!--
> > function Get_Cookie(name) {
> > var start = document.cookie.indexOf(name+"=");
> > var len = start+name.length+1;
> > if ((!start)&&(name != document.cookie.substring(0,name.length)))
>return
> > null;
> > if (start == 1) return null;
> > var end = document.cookie.indexOf(";",len);
> > if (end == 1) end = document.cookie.length;
> > return unescape (document.cookie.substring(len,end));
> > }
> > function Set_Cookie(name,value,expires,path,domain,secure) {
> > document.cookie = name + "=" +escape(value) +
> > ( (expires) ? ";expires=" + expires.toGNTString
>() : " ")
> > +
> > ( (path) ? ";path=" +path : " ")
> > +
> > ( (domain) ? ";domain=" +domain : " ")
> > +
> > ( (secure) ? ";secure=" +secure : " ");
> >
> > function setupForm()
> > {
> > if (purchase) getValues(purchase);
> > }
> > // C=Name of the Form Product = name of input
> > function getValues(string){
> > getValue(string,"Cart", document.Product1.Cart,"text");
> > getValue(string,"C1", document.Product1.C1,"select");
> > getValue(string,"each", document.Product1.each,"select");
> > getValue(string,"total", document.Product1.total,"select");
> > getValue(string,"Cart", document.Product2.Cart,"text");
> > getValue(string,"C2", document.Product2.C2,"select");
> > getValue(string,"each", document.Product2.each,"select");
> > getValue(string,"total", document.Product2.total,"select");
> > getValue(string,"Cart", document.Product3.Cart,"text");
> > getValue(string,"C3", document.Product3.C3,"select");
> > getValue(string,"each", document.Product3.each,"select");
> > getValue(string,"total", document.Product3.total,"select");
> > getValue(string,"Cart", document.Product4.Cart,"text");
> > getValue(string,"C4", document.Product4.C4,"select");
> > getValue(string,"each", document.Product4.each,"select");
> > getValue(string,"total", document.Product4.total,"select");
> > getValue(string,"Cart", document.Product5.Cart,"text");
> > getValue(string,"C5", document.Product5.C5,"select");
> > getValue(string,"each", document.Product5.each,"select");
> > getValue(string,"total", document.Product5.total,"select");
> > getValue(string,"Cart", document.Product6.Cart,"text");
> > getValue(string,"C6", document.Product6.C6,"select");
> > getValue(string,"each", document.Product6.each,"select");
> > getValue(string,"total", document.Product6.total,"select");
> > getValue(string, "OrderForm",
>document.sub.OrderForm,"text");
> > getValue(string, "OrderForm",
>document.Ship.OrderForm,"radio");
> > getValue(string, "OrderForm",
>document.sub1.OrderForm,"text");
> > getValue(string, "OrderForm",
>document.tax.OrderForm,"text");
> > getValue(string, "OrderForm",
>document.total.OrderForm,"text");
> >
> > function getValue(string,elementName,object,elementType){
> > // gets values of elementName from string and populates object of
> > elementType
> >
> > var startPos = string.indexOf(elementName + "=")
> >
> > if (startPos > -1){
> > startPos = startPos + element.Name.length
>+1;
> > var endPos = string.indexOf("&",startPos);
> > if (endPos == -1) endPos = string.length;
> >
> > var elementValue = unescape
>(string.substring(startPos,endPos));
> >
> > if (elemetType == "text")
>object.value = elementValue;
> > if (elemetType == "select")
>object.selectIndex = elementValue;
> >
> > }
> > }
> >
> > //--></script>
> >
> > <!--I load the script -->
> > <body onLoad="setupForm();">
> >
> > <!--The get.js is the script that goes below the body tag so it could
>load
> > the cookie values-->
> >
> > <script language="Javascript"><!--
> > var today = newDate();
> > var expires = new Date(today.getTime() +(1));
> >
> > var searchString = replace(self.location.search.substring(1),"+", " ");
> > if (searchString.length > 0)
> > Set_Cookie("purchase");
> > //--></script>
> >
> > If someone could help me I would really appreciate it
> >
> >
> > Thank You
> >
> > Kahine
>