Search Results for 'innerHTML' (1 Posts)

  1. 2008/05/07 让 innerHTML 中的脚本跑起来 (1) - explon
qrcode Mobile version:
我们知道普通方式 innerHTML 到容器中的脚本浏览器器是不会执行的,今天看 mootools 的时候发现靠它可以做到.

Ajax 类的说明:
Class: Ajax
    An Ajax class, For all your asynchronous needs.
    Inherits methods, properties, options and events from <xhr>.

Arguments:
    url - the url pointing to the server-side script.
    options - optional, an object containing options.

Options:
    data - you can write parameters here. Can be a querystring, an object or a Form element.
    update - $(element) to insert the response text of the XHR into, upon completion of the request.
    evalScripts - boolean; default is false. Execute scripts in the response text onComplete. When the response is javascript the whole response is evaluated.
    evalResponse - boolean; default is false. Force global evalulation of the whole response, no matter what content-type it is.
   
Events:
    onComplete - function to execute when the ajax request completes.</xhr>



Example:
>var myAjax = new Ajax('js.txt', {method: 'get', update: $$('body'), evalScripts: true}).request();
js.txt:
<script type="text/javascript"> alert('TEST'); </script>

2008/05/07 15:11 2008/05/07 15:11

댓글을 달아 주세요

  1. smartly 2008/05/20 16:05

    天将降大任于斯国也,必先撞其火车,抢其火炬,震其国土,涨其物价,空乏其民,行拂乱其股市! 大国崛起之征兆也.

write a comment