Hi,

I am stuck on some ugly code I am trying to optimize. The problem is,
that I cannot reference to a variable without using eval (which is
unsafe and slow). I tried to replace it with the square bracket
notation (while removing the quotes in the function call), but cannot
get it to work. Any help is much appreciated!
Here is the code:

var logoload;
var logourl="http://foo.bar";;

function viewonopen()
{
XHR("logoload", "logourl", "loadlogo");
}
function XHR(name, url, readystatefunction) {
mycode = name +"=null;";
mycode += name +"=new XMLHttpRequest();";
mycode += name +".onreadystatechange="+readystatefunction+";";
mycode += name +".open(\"GET\","+url+",true);";
mycode += name +".send(null);";
eval(mycode);
}
function loadlogo() {
if(logoload.readyState!=4) return; //  NOT READY
if(logoload.status!=200) return;    //  FAILED
img1.src = logoload.responseStream;
img1.visible = true;
logoload = null;
}

Thanks,
Sebastian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to