mootools

Simplest way of getting the number of decimals in a number in JavaScript [duplicate]

落爺英雄遲暮 提交于 2019-11-27 13:31:28
问题 This question already has an answer here: Is there a reliable way in JavaScript to obtain the number of decimal places of an arbitrary number? 7 answers Is there a better way of figuring out the number of decimals on a number than in my example? var nbr = 37.435.45; var decimals = (nbr!=Math.floor(nbr))?(nbr.toString()).split('.')[1].length:0; By better I mean faster to execute and/or using a native JavaScript function, ie. something like nbr.getDecimals(). Thanks in advance! EDIT: After

What advantages does jQuery have over other JavaScript libraries?

狂风中的少年 提交于 2019-11-27 12:57:34
问题 I am trying to convince those who set standards at my current organization that we should use jQuery rather than Prototype and/or YUI. What are some convincing advantages I can use to convince them? 回答1: The 3 main advantages of jQuery are: its light weight when compared to other javascript frameworks it has a wide range of plugins available for various specific needs it is easier for a designer to learn jQuery as it uses familiar CSS syntax. jQuery is Javascript for Designers 回答2: I would

Adding event to element inside Google Maps API InfoWindow

徘徊边缘 提交于 2019-11-27 12:25:10
I want to put a form with input field and submit button inside a Google Maps API (v3) InfoWindow. When submitted I would like to call a function that initiates the directions service using the address entered into the input field. Here's my code (I'm currently only testing whether the directions event is being fired. I've written the full getDirections() event and can confirm it works and returns directions when fired properly): I tried adding an event listener using MooTools, like this: var infoWindowContent = "<b>Get Directions From...</b><br />" + "<form id='map-form'>" + "Address/Postcode:

a simple question on jquery closure

夙愿已清 提交于 2019-11-27 11:43:12
what does this mean? (function($){ })(jQuery); to make the question clearer, what does wrapping a function in parenthesis mean in JS (sorry, I'm a bit confused on the concept of closures). What about the $ parameter? and the "jQuery" in the end parenthesis? Can I do the same with mootools and combine them in 1 JS file? (function($){})(jQuery); (function($){})(mooTools); I have only worked with jquery and am planning to work with Mootools CMS Wrapping a function between parenthesis ensures this function to be evaluated as a function expression . That happens because the Grouping Operator (the

Great uploader like uploadify but with a “no-flash” fallback [closed]

纵饮孤独 提交于 2019-11-27 11:16:15
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Is there a great uploader script that uses jQuery, like uploadify, but with a fallback option for when flash is not available? I tried

How do jQuery do its cross-domain ajax calls and how can I replicate em with mootools

五迷三道 提交于 2019-11-27 03:06:21
问题 in my eternal internal fight on whether to stay with mootools or jump to jQuery I've found on the jQuery documentation something that got my attention and this is that jQuery can ask for a JSON to a different domain, which is usually forbidden by the browser. I've seen some workarounds for cross-subdomain, but never cross-domain, and I'm really thrilled, first I thought I was server related but experimenting a little bit more I've seend that doing the very same JSON request from jQuery docs

JS弹框,支持ajax调用、拖拽,jquery、mootools两个版本

扶醉桌前 提交于 2019-11-27 03:04:42
JS弹窗,有jquery和mootools两个版本 要求:jquery版本>=1.2.6,mootools用最新版本 先看截图啊: 在firefox、chrome、高版本ie下:有阴影、圆角效果 调用方法: <input type="button" value="居中" onclick="mybox({title:'老衲',content:'B你好<br><br><br><br>世界',width:200,height:100,pos:'center'})" /> <input type="button" value="右下角" onclick="mybox({width:400,height:200,pos:'rightdown'})" /> <input type="button" value="ajax调用" onclick="mybox({width:400,height:200,ctype:'url',url:'echo.php'})" /> 样式:css <style type="text/css"> *{ margin:0; padding:0;} .popbox{ position:absolute; width:300px; border:1px solid #84a0c4; background:#d3e2f5; border-radius:3px; box

几种流行的AJAX框架:jQuery,Mootools,Dojo,Ext JS的对比

北慕城南 提交于 2019-11-27 03:04:30
轻量级的选择:主要是mootools和jquery,由于它们的设计思想的不同,jQuery是追求简洁和高效,Mootools除了追求 这些目标以外,其核心在于面向对象,所以jQuery适合于快速开发,Mootools适合于稍大型和复杂的项目,其中需要面向对象的支持;另外,在 Ajax的支持上,jQuery稍强一些;在Comet的支持上,jQuery有相关的插件,Mootools目前没有,但是Comet的核心在于服务器 的支持,浏览器端的接口很简单,开发相关的插件很简单。 在面向对象的Javascript Library中,mootools逐渐战胜了prototype(体积大,面向对象的设计不合理等),也包括script.acul.ous(基于prototype,实际上就是prototype上的UI库)。 面向RIA的框架,考虑纯JavaScripty库,目前主要是Dojo和ExtJS(还有YUI)。Dojo更适合企业应用和产品开发的需要,因为离线存储、 DataGrid、2D、3D图形、Chart、Comet等组件对于企业应用来说都是很重要的(当然这些组件还要等一段时间才能稳定下来)。例 如,BEA基于Mashup技术开发的产品中已经使用了Dojo。 ExtJS:美观和”易用”,并且足够强大。在对UI有比较大的需求时,是首选。 来源: oschina 链接: https://my

how to implement a jQuery live bind event on mootools?

非 Y 不嫁゛ 提交于 2019-11-27 03:00:04
问题 How do I make elements that are loaded via ajax, adopt the events associated with the same class on mootools 1.11? As far as I know, in jQquery, if your ajax response consists of something like <div class='button'> , if there is an event bind using live to $('.button') , those events would automatically bind. Is that possible with MooTools 1.11? 回答1: Perhaps something like this might do what you're looking for? Though I'm not sure if it'll work with 1.11. Element.implement({ addLiveEvent:

DOM Element Width before Appended to DOM

折月煮酒 提交于 2019-11-27 02:10:16
问题 I'm sure the answer is no, but is it possible to determine the width of an element before it is appended to the DOM? Once it's appended, I know I can use offsetWidth and offsetHeight. Thanks 回答1: The trick is to show the element (display:block) but also hide it (visibility:hidden) and to set it’s position to absolute so that it doesn’t affect the page flow. The MooTools Element.Measure class does this, as Oscar mentioned. 回答2: The Mootools Element.Measure functionality that Oscar mentioned is