MooTools is a collection of JavaScript utilities designed for the intermediate to advanced JavaScript developer. It allows you to write powerful and flexible code with its elegant, well documented, and coherent APIs.
MooTools code is extensively documented and easy to read, enabling you to extend the functionality to match your requirements.
官网:http://mootools.net/
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script
src="http://libs.baidu.com/mootools/1.4.5/mootools-yui-compressed.js"></script>
<title>test</title>
</head>
<body>
<button onclick="test()">test</button>
<br>
<div id="myElement"></div>
<script type="text/javascript">
function test() {
var myElement = document.id('myElement');
var myRequest = new Request({
url : 'http://localhost',
method : 'get',
onRequest : function() {
myElement.set('text', 'loading...');
},
onSuccess : function(responseText) {
myElement.set('text', responseText);
},
onFailure : function() {
myElement.set('text', 'Sorry, your request failed :(');
}
});
myRequest.send();
}
</script>
</body>
</html>
本文介绍MooTools JavaScript库的使用方法,并提供了一个实际应用案例。案例展示了如何利用MooTools进行AJAX请求,包括加载提示、请求成功与失败后的处理。

被折叠的 条评论
为什么被折叠?



