Показать сообщение отдельно
  #2 (permalink)  
Старый 01.09.2011, 00:40
sinistral
Посмотреть профиль Найти все сообщения от melky
 
Регистрация: 28.03.2011
Сообщений: 5,418

надо eval'ить скрипт.

пример из prototypejs.

var ScriptFragment = '<script[^>]*>([\\S\\s]*?)<\/script>';
function extractScripts() {
    var matchAll = new RegExp(ScriptFragment, 'img'),
        matchOne = new RegExp(ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
}
function evalScripts() {
    return this.extractScripts().map(function(script) { return eval(script) });
}
String.prototype.extractScripts = extractScripts;
String.prototype.evalScripts = evalScripts;

*!*
"<div>loloiiu</div>*!*<script>alert('hello from ajax!')</script>*/!*lolol<span>lkjlkj</span>lkjlkj"*!*.evalScripts()*/!*
*/!*
Ответить с цитированием