Re: HWG-LANGUAGES - IE Error in setCookie script

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Sat, 11 Mar 2000 20:53:29 CST
 To:  kransdell(at)squishedmosquito.com
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
a few things wrong here. first of all your funtion is missing its formal 
parameters. in this case you only need open and close parentheses because no 
values are being passed to the function. your ending HTML comment needs a 
javascript comment before it. also, you needn't re-add the previous cookie 
string when adding values. the string isn't maintained like an ordinary 
string, the browser interprets the data sent to it and rebuilds the string. 
i find it hard to believe that netscape would accept this code as is! try 
this:

<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide
function setCookie() {
   document.cookie="QTYITEM0=0";
   document.cookie="QTYITEM1="+QTYITEM1.value;
   document.cookie="QTYITEM2="+QTYITEM2.value;
   document.cookie="QTYITEM3="+QTYITEM3.value;
   document.cookie="QTYITEM4="+QTYITEM4.value;
   document.cookie="QTYITEM5="+QTYITEM5.value;
   document.cookie="QTYITEM6="+QTYITEM6.value;
   document.cookie="QTYITEM7="+QTYITEM7.value;
   document.cookie="QTYITEM8="+QTYITEM8.value
   document.cookie="QTYITEM9="+QTYITEM9.value;
   }
//-->
</SCRIPT>

- Cyanide_7

>
>The following script is used in the head of a shopping cart page where
>customers select merchandise items.  No problems whatsoever in NN4, but IE
>tosses out an error " Expected ( ".  Ooooookay......
>
>Would someone please be so kind as to look at this and tell me just what 
>the
>glitch is, or if it's just something that IE inflicts just because it's
>going to.  <haRUMPH!>
>
>
><SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
><!-- Hide
>function setCookie {
>   document.cookie="QTYITEM0=0"
>   document.cookie=document.cookie+"QTYITEM1="+QTYITEM1.value
>   document.cookie=document.cookie+"QTYITEM2="+QTYITEM2.value
>   document.cookie=document.cookie+"QTYITEM3="+QTYITEM3.value
>   document.cookie=document.cookie+"QTYITEM4="+QTYITEM4.value
>   document.cookie=document.cookie+"QTYITEM5="+QTYITEM5.value
>   document.cookie=document.cookie+"QTYITEM6="+QTYITEM6.value
>   document.cookie=document.cookie+"QTYITEM7="+QTYITEM7.value
>   document.cookie=document.cookie+"QTYITEM8="+QTYITEM8.value
>   document.cookie=document.cookie+"QTYITEM9="+QTYITEM9.value
>
>   }
>-->
></SCRIPT>
>
>It also chokes (IE only) on the submit action
>
><INPUT TYPE="submit" NAME="button" VALUE="Order" 
>onClick="setCookie()"></TD>
>
>the error message is "Object expected"
>
>Thanks muchly!!
>
>Karin
>
>
>
>
>
>
>-------------------------------------------------------------------
>This message has been posted from Mail2Web http://www.mail2web.com/
>Web Hosting for $9.95 per month! Visit: http://www.yourhosting.com/
>-------------------------------------------------------------------
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA