Type Mismatch error

Memnoch1207
07-30-2002, 01:18 PM
I am creating a simple e-commerce site (simple...yeah, right) anyway...I am using javascript and keep getting an error on a particular line in the code...but it doesn't make sense...

It's a type MISMATCH error


ExpireDate = new Date();
ExpireDate.setMonth(ExpireDate.getMonth() + 3);
Response.Cookies("ShoppingCart").expires = ExpireDate.toLocaleString(); 'errors out here!

Response.Cookies("ShoppingCart")("itemcount") = j;


can anyone help me out on this?

Memnoch1207
07-30-2002, 01:28 PM
If I comment out the lines of code above, then it works just fine? The code above is just to set the cookie object to expire after 3 months...don't know why it would cause an error though??

Rezner
07-30-2002, 01:40 PM
It looks to me like you're trying to simultaneously use VBScript (ASP) and JavaScript in the same script segment. You can use JavaScript serverside, but you may as well stick with VBScript.

You should set a VBScript Cookie with VBScript and not JavaScript. Something like this:Response.Cookies("ShoppingCart").Expires = DateAdd("m",Now,3)

Response.Cookies("ShoppingCart")("itemcount") = j;

Derek Stone
07-30-2002, 01:40 PM
Your attempting to set the .Expires to a string value. I'm fairly sure it requires a variable of type Date.


currentDate = Date
newDate = DateAdd("m",3,currentDate)
response.write newDate

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum