The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

also, i've asked this on the php list but i'll pop it on the end here as well (it's semi php, semi js question) (this is trying to find out the source of the same problem as the above question is trying to fix):

on an ajax type of http request i'm setting a cookie using the php function session(). this works ok in other browsers but not ie7 (possibly other ie's). i found stated on various webpages (e.g. http://stackoverflow.com/questions/3...ernet-explorer ) that there's a problem with ajax and iframes and cookies. could this be related. to be honest i don't even know what an iframe is. is it an html element. if so i'm definitely not using an iframe.

anyway my problem which i can not fathom at the moment isn't to do with cookies not being set it seems. that's fine. it's something to do with the communication of cookies with requests or the code on the php server which deals with it. but seeing as it's a 100% fine in safari and firefox but intermittently working and not working in ie7 that indicates possibly that it's something to do with javascript because the browser doesn't make much difference to php.

surely that happens automatically, no? not if i were using === but with == surely there's a type conversion which happens?

It may happen in some browsers, but JavaScript isn't supposed to do any automatic type casting on strings (that I'm aware of). PHP, on the other hand, will gladly convert just about anything you throw at it.

i haven't been able to find the exact situation we're talking about described in my js book but i have found this which is very similar:

"1" == true

This expression evaluates to true ... The boolean value true is first converted to the number 1, and the comparison is done again. Next, the string "1" is converted to the number 1. Since both numbers are nw the same, the comparison returns true;

actually, i've just realisd, this is all completely irrelevant! we're actually talking about the return value of indexOf which returns -1 when what was being searched for wasn't found. so i don't think i need parseInt()

When comparing a number and a string, the string is converted to a number value. JavaScript attempts to convert the string numeric literal to a Number type value. First, a mathematical value is derived from the string numeric literal. Next, this value is rounded to nearest Number type value.

If one of the operands is Boolean, the Boolean operand is converted to 1 if it is true and +0 if it is false.
If an object is compared with a number or string, JavaScript attempts to return the default value for the object. Operators attempt to convert the object to a primitive value, a String or Number value, using the valueOf and toString methods of the objects.

If this attempt to convert the object fails, a runtime error is generated.