Ver Mensaje Individual
  #29 (permalink)  
Antiguo 03/05/2007, 10:18
Avatar de erlingfiallos
erlingfiallos
 
Fecha de Ingreso: febrero-2005
Ubicación: Mexico ahora
Mensajes: 499
Antigüedad: 19 años, 3 meses
Puntos: 9
Re: sobre ajax, porque no lo hace ?

bueno, que yo sepa y segun mis pruebas.. no es necesario enviar en una respuesta de ajax algo como
Código:
<script type="text/javascript" src="js/mootools.v1.00.js"></script>
simplemente eso se incluye en la pagina de donde se hace la peticion y con eso debe de funcionar..

y lo que ha escrito Asyolath se mira muy bonito.. no lo he probado pero puedo apostar que funciona..

yo lo que habia hecho para no tener que usar prototype y poder ejecutar scripts en forma

Código:
<script>...</script>
me robe un trozo de prototype.. precisamente lo que permite ejecutar esos codigos..

Código:
function buscarscripts(elemento_res) {
	var script = document.getElementById(elemento_res).innerHTML;
	script = script.extractScripts();
	for(i=0;i<script.length;i++)
		instalar(script[i]);
}

function instalar(script) {
	script = script.replace("<!--","");
	script = script.replace("//-->","");
	if (window.execScript)
		window.execScript(script);
	else
		window.setTimeout(script, 0);
}

var proo = {  
  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
  emptyFunction: function() {},  
}

Object.extend(String.prototype, {
  stripTags: function() {
    return this.replace(/<\/?[^>]+>/gi, '');
  },

  extractScripts: function() {
    var matchAll = new RegExp(proo.ScriptFragment, 'img');
    var matchOne = new RegExp(proo.ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
  }  
});