解决innerHTML中的script不能执行的问题

// eval scripts from text (from mootools)
function evalScripts(text){
    var script, scripts;
    scripts = [];
    var regexp = /<script[^>]*>([\s\S]*?)<\/script>/gi;
    while ((script = regexp.exec(text))) scripts.push(script[1]);
    scripts = scripts.join('\n');

    if (scripts) (window.execScript) ? window.execScript(scripts) : window.setTimeout(scripts, 0);
}

posted @ 2010-09-19 11:50 果果’er 阅读(151) 评论(0) 编辑 收藏
发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 1830883 oRQzxinOVik=