D
david.sullivan
I have a string generated by server side code that is like the
following.
((1,'A'),(2,'B')) shortened for brevity.
I was hoping to be able to use javascript's eval function then loop
though the array to do a find an replace.
var tURL = document.getElementById("url").value;
var sArray = Array(eval("(" + document.getElementById
("txtFields").value + ")"));
var iArray;
for (i = 0; i < sArray.length; i++)
{
iArray = sArray;
tURL = tURL.replace(iArray[1], iArray[0]);
}
Am I just going about this all wrong or what?
following.
((1,'A'),(2,'B')) shortened for brevity.
I was hoping to be able to use javascript's eval function then loop
though the array to do a find an replace.
var tURL = document.getElementById("url").value;
var sArray = Array(eval("(" + document.getElementById
("txtFields").value + ")"));
var iArray;
for (i = 0; i < sArray.length; i++)
{
iArray = sArray;
tURL = tURL.replace(iArray[1], iArray[0]);
}
Am I just going about this all wrong or what?