关于js字符串转成函数
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <p id="demo">My First Paragraph.</p> <script> var jsText = 'function(s){alert(s);return s+1;}' var jscode = new Function('return '+jsText)(); var a=jscode(2); alert(a+1); </script> </body> </html>
相关推荐
zjnig的信息仓库 2019-04-30
yuanlintufang 2016-04-27
hong 2015-12-28
yesbuy00 2014-07-23
辣m精彩 2014-01-22
niehanmin 2013-11-26
zwq 2013-04-11
黎豆子 2012-10-29
WinerChopin 2012-06-05
lovehuayud 2012-02-22
别告诉我有Bug 2011-09-22
zhangpeng 2011-03-29
zwq 2011-03-05
xdyangxiaoromg 2019-05-09
heicxsudoblog 2019-05-08
移动开发与培训 2011-11-14