Can someone tell me why this eval() doesn't work in IE 
Author Message
 Can someone tell me why this eval() doesn't work in IE

paramArray[0] = "item=html"

name = paramArray[0].substring(0, paramArray[0].indexOf("="));
value = paramArray[0].substring(paramArray[0].indexOf("=")+1);

eval(name+"=value");

// alert(item) should show "html" but nothing happens in IE
// however, it does in NS. Please help.

// - Matt



Fri, 13 Feb 2004 04:56:17 GMT  
 Can someone tell me why this eval() doesn't work in IE
Is there some reason why you're not just doing this:

paramArray[0] = "item=html";
eval(paramArray[0]);

which seems to be exactly the same without the complicated middle steps?

BTW, following your original direction you should try using:

eval(name+"="+value);

or

window[name]=value;

since variables are just properties of the window.

Additionally, I would avoid using either "name" or "value" as variable names.

Tim.

Quote:

> paramArray[0] = "item=html"

> name = paramArray[0].substring(0, paramArray[0].indexOf("="));
> value = paramArray[0].substring(paramArray[0].indexOf("=")+1);

> eval(name+"=value");

> // alert(item) should show "html" but nothing happens in IE
> // however, it does in NS. Please help.

> // - Matt



Fri, 13 Feb 2004 07:35:31 GMT  
 Can someone tell me why this eval() doesn't work in IE
I'm sure something is happening in IE, just not what you expected. Do you
have "Display a notification about every script error" turned on in IE's
Tools | Options | Advanced dialog?

paramArray[0] = "item=html"

name = paramArray[0].substring(0, paramArray[0].indexOf("="));
value = paramArray[0].substring(paramArray[0].indexOf("=")+1);

eval(name+"=value");

// alert(item) should show "html" but nothing happens in IE
// however, it does in NS. Please help.

// - Matt



Fri, 13 Feb 2004 11:45:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Can someone tell me why this doesn't work please

2. Why LoadPicture() works on local pathes and doesn't work on the URLS

3. works / doesn't work, why?

4. VBScript Eval function doesn't work properly

5. Can you please tell me why this don't work

6. Why doesn't this work

7. Why doesn't it work?

8. Why doesn't this work?

9. newbie: aarrggh - why doesn't this work?

10. RegExp question, why doesn't this work?

11. Why doesn't this work!

12. Puzzled: Why doesn't this work?

 

 
Powered by phpBB® Forum Software