eval("var " + str)
console.log(win)
eval(str+"=3")
console.info(win)
[javascript]var test='{ colkey: "col", colsinfo: "NameList" }'
var test='{ colkey: "col", colsinfo: "NameList" }'
2.把文本转化为对象
[javascript]
var test='{ colkey: "col", colsinfo: "NameList" }'
var obj2=eval("("+test+")")
alert(obj2.colsinfo)
var test='{ colkey: "col", colsinfo: "NameList" }'
var obj2=eval("("+test+")")
alert(obj2.colsinfo)
3.把文本转化为数组
[javascript]
var test='["colkey", "col", "colsinfo","NameList" ]'
var obj2=eval("("+test+")")
alert(obj2.length)