首页 > 代码库 > javascript将字符串转为对象

javascript将字符串转为对象

javascript将字符串转为对象
<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title></title>        <script>            var keyword = window.location.search.substring(1);            // 取查询字符串            var pos = keyword.indexOf(=);            var argname = keyword.substring(0, pos);            var JobType;            keyword = decodeURIComponent(keyword.substring(pos + 1));                        eval(argname + " = \"" + keyword + "\";");            console.log(JobType);        </script>    </head>    <body></body></html>