mootools

MooTools教程(2):DOM选择器

元气小坏坏 提交于 2019-12-20 20:35:33
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如果你还没有准备好,请先阅读上一篇 《Mootools 1.2教程(1)——MooTools介绍》 。我们讲了怎么引用MooTools 1.2以及怎么在domready里面调用你的脚本。 今天开始本系列教程的第2讲。在这一讲中,我们会学习几种选择HTML元素的方法。在许多方面,这是MooTools用得最多最基本的。毕竟,要创建一个基于HTML元素的交互性用户体验,你必须首先把它们掌握在手中。 基本的方法 $(); $函数是MooTools中基本的选择器。你可以通过它来根据一个ID选择DOM元素。 参考代码: [复制代码] [保存代码] // 选择ID为”body_wrap“的元素 $( 'body_wrap' ); 参考代码: [复制代码] [保存代码] "body_wrap"> .getElement(); .getElement();扩展了$方法,可以让你简化你的选择操作。例如,你可以通过$方法来选择ID为”body_wrap“的元素,然后选 择第一个子节点。.getElement();只选择一个元素,如果有多个符合要求的元素则返回第一个元素。如果你给.getElement();方法一 个CSS类名作为参数,你就会得到第一个有这个CSS类名的元素,而不是函数所有元素的数组。要选择多个元素,则可以使用下面 的

What exactly is DOM Extension / Wrapping?

眉间皱痕 提交于 2019-12-20 11:32:04
问题 I have 2 main questions. Does extending things like Object count? What is DOM wrapping? http://perfectionkills.com/whats-wrong-with-extending-the-dom/ After reading that article I couldn't find anything about DOM wrapping, and no specification and what exactly is and isn't DOM extension. 回答1: No, Object is specified as part of the Javascript language , while the DOM is an API only relevant in a browser environment and is used to "access and update the content, structure and style of documents

What exactly is DOM Extension / Wrapping?

微笑、不失礼 提交于 2019-12-20 11:31:45
问题 I have 2 main questions. Does extending things like Object count? What is DOM wrapping? http://perfectionkills.com/whats-wrong-with-extending-the-dom/ After reading that article I couldn't find anything about DOM wrapping, and no specification and what exactly is and isn't DOM extension. 回答1: No, Object is specified as part of the Javascript language , while the DOM is an API only relevant in a browser environment and is used to "access and update the content, structure and style of documents

PHP - generating JavaScript

佐手、 提交于 2019-12-20 09:55:48
问题 I am working on a project which has a lot of JavaScript. I think that generating simple strings and putting them between "<script>" tags is not the best way to do it. Are there any better approaches to generate JavaScript objects, functions, calls etc? Maybe some convering classes (from PHP to JavaScript) or maybe there are design patterns I should follow? PS. If it has any relevance - I am using MooTools with MochaUI (with MochaPHPControl). Thanks in advance for the help. 回答1: The best

date picker not appearing after clicking on image

纵然是瞬间 提交于 2019-12-20 07:23:21
问题 I have a fiddle which displays date picker. same code i have written below but nothing happens, what wrong i am doing? When i click on that green colour then no date picker is generated, but in fiddle it is coming fine, where i am doing wrong? http://jsfiddle.net/cBwEK/10/ <html> <head> <script type="text/javascript" src="mootools-yui-compressed.js"></script>//mootools script <script type="text/javascript" src="datepicker.js"></script> <link rel="stylesheet" type="text/css" href="datepicker

JQuery Slideshow and MooTools Conflict

不羁岁月 提交于 2019-12-20 06:37:05
问题 I am having a problem with the motools library conflicting with my jQuery library: Here's the code: <script language="Javascript" type="text/javascript" src="revamp/js/jquery-1.4.2.js"></script> <script language="Javascript" type="text/javascript" src="revamp/js/jquery.blinds-0.9.js"></script> <script type="text/javascript" src="js/mootools-1.2-core.js"></script> <script type="text/javascript" src="js/_class.viewer.js"></script> <script type="text/javascript">//<![CDATA[ window.addEvent(

I am able to draw the box but I am not able to remove it! (Canvas)

Deadly 提交于 2019-12-20 04:16:15
问题 I have asked this question before and it seemed that the code I was using was pretty confusing. So this is a virtually dumed down version of the same code. I draw a square on the canvas using the add function. Like wise I should be able to remove the item from the canvas using the remove function! Alas it doesn't seem to happen so. Here is the code $(window).addEvent('load',function(){ CANVAS.init({ canvasElement : 'canvas' }); CANVAS.layers.add( new Layer({ id : 'myLayer' })); var colors = [

how to replace bindwithevent in mootools 1.3

痞子三分冷 提交于 2019-12-20 03:38:10
问题 I wonder how to replace the bindWithEvent function in Mootools 1.3, the example in the documentation is very basic: Element.addEvent('click', function(e){ myFunction.bind(bind, [e]);}); But, what about if I need to pass a param to the event handler? This is the way in Mootools 1.2: Element.addEvent('click', function(e, param) { e.stop(); alert(param) }.bindWithEvent(this,['text']); Any idea on how to replace this in Mootools 1.3. Update: I found a very ugly solution, but a least it works

Javascript array iteration using for..in with MooTools included

自闭症网瘾萝莉.ら 提交于 2019-12-20 01:08:56
问题 I am iterating over an array in MooTools but seeing additional items when iterating through the array using the shorthand for..in loop. It works fine when I use the regular for loop. Is this a problem with MooTools polluting the global namespace or am I doing something wrong here? There is a createTabs() function that iterates over an array and creates a tab for each value in the array: function createTabs() { var myTabs = [["First", "a.png"], ["Second", "b.png"]]; for(var i in myTabs) { var

What is jQuery (edge) in jsfiddle.net?

主宰稳场 提交于 2019-12-18 13:51:48
问题 In jsfiddle.net if one choose framework as jQuery or Mootools they will get an option for choosing jQuery ( edge ) and Mootools( edge ). I googled it quite a bit but did not get any good answers. My questions are What are those versions? How are they useful to the fiddle creator? 回答1: It is the jQuery nightly build from github... jQuery JavaScript Library v1.6.3pre Live From Git (b22c9046529852c7ce567df13397849e11e2b9cc) Here is the link: link (jsfiddle uses this) Here is the jQuery github