让 innerHTML 中的脚本跑起来
Web Development
2008/05/07 15:11
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>




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