首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

eval火狐报错,该如何做

2012-04-28 
eval火狐报错,该怎么做$strfunction(){window.location.hrefhttp://www.baidu.com}然后eval($str)(

eval火狐报错,该怎么做
$str="function(){window.location.href='http://www.baidu.com'}";

然后 eval($str)()


出错了,,无法跳转,怎么做

[解决办法]
$str = "window.location.href='http://www.baidu.com'";
eval($str);
[解决办法]
多了一个()吧,去掉再调调看
[解决办法]
$str="function(){window.location.href='http://www.baidu.com'}";

$str = eval('('+$str+')');
alert(typeof $str)
$str()
[解决办法]

JScript code
$str="(function(){window.location.href='http://www.baidu.com'})";eval($str)()
[解决办法]
$str="void function(){window.location.href='http://www.baidu.com'}()";
 eval($str)
[解决办法]
探讨

$str="function(){window.location.href='http://www.baidu.com'}";

$str = eval('('+$str+')');
alert(typeof $str)
$str()

热点排行