javascript
文章平均质量分 65
iteye_13882
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Javascript and its !! (double exclamation mark) opertaor
Let's first see a code example that has !! operator turned on var store = { id : 1 , cache : {}, add : function(fn) { if (!fn.id) { fn.id = store.id++; return !!(...原创 2012-07-28 22:46:56 · 174 阅读 · 0 评论 -
javascript - trick to get and set CSS style
while it will not be so much trouble if not for IE; most of the browers will use the attribute style,and you can set string to the via get/setAttribute("style"), but it does not work for ie, ie has a ...原创 2012-08-16 11:00:01 · 142 阅读 · 0 评论 -
javascript - trick to normalize href for IE
IE is again the only browser that has a special bug that violate the priciple of least surprise. that is that when accessing an attribute that references a URL, (such as href, src, or action) ...原创 2012-08-16 10:59:46 · 114 阅读 · 0 评论 -
javascript - trick IE form and its expando attribute
there is a known issue that if you have a form with several inupt elements, and those elemnt happens to have specific id or names then the elements becomes the expando attribute of the form element. ...原创 2012-08-16 10:59:26 · 125 阅读 · 0 评论 -
javascript - tricks to deal with colors
There are a couple of ways to represent a color information. and it always cause confusion across different browsers. • rgb(R,G,B) - Where R, G, B are numbers from 0 to 255.• rgb(R%,G%,B%)...原创 2012-08-15 08:34:20 · 171 阅读 · 0 评论 -
javascript - trick to manipulate the opacity
All other browsre may have supported the opacity CSS property whereas Internext explorer use its properietary alpha filter. opacity: 0.5;filter: alpha(opacity=50); where opacity nota...原创 2012-08-15 08:26:15 · 118 阅读 · 0 评论 -
javascript - trick to test visibility of an element
though there is a visible property that you can test if a element is having the visibility set to true (display = none), however, it is more arguable why not just to test the offsetWidth and the offse...原创 2012-08-15 08:15:05 · 118 阅读 · 0 评论 -
javascript - trick to get and set height and width
when looking at properties that could have an auto value, it was mentioned that height and width are two properties that frequently have these values. the offsetHeight and offsetWidth pro...原创 2012-08-15 08:05:42 · 113 阅读 · 0 评论 -
javascript expando and attributes
expando is something like this elem.attr, or you can use something like this: elem[attr]; while attribute is something like this: elem.getAttribute("attr_name"); there are something a...原创 2012-08-14 08:15:22 · 162 阅读 · 0 评论 -
javascript - trick to set/get attributes that expects px values
When setting a number into a style property you must specify the unit in order for it to work across all browsers. <html><head><title>Pixel Style Test</title>&l...原创 2012-08-16 11:00:35 · 103 阅读 · 0 评论 -
javascript - trick to fix the event object
Many browsers, especially Internet Explorer, miss out on a number of the W3C event object propertiesand methods. The only reasonable way to work around this is to create a new object that simulat...原创 2012-08-20 07:47:01 · 137 阅读 · 0 评论 -
javascript - trick to simulate mouseenter and mouseleave
Previously we discussed javascript - trick to handlers management for add/remove custom events. and javascript - trick to detect bubbling supportability to test if a certain event is supported i...原创 2012-08-23 08:31:33 · 163 阅读 · 0 评论 -
javascript - trick to implement bubbling submit event
Following up to the javascript - trick to detect bubbling supportability and the introduction about the bubbling event, one of the event that does not support bubbling is the submit event in IE. How...原创 2012-08-23 07:55:16 · 237 阅读 · 0 评论 -
javascript - trick to simulate the change event
In the previous discussion about javascript - trigger event and custom events and javascript - trigger event and custom events, we talked about how to add/remove custom events and how to trigger th...原创 2012-08-22 08:51:36 · 176 阅读 · 0 评论 -
javascript - trick to simulate bubbling submit event
In the previous discussion about javascript - trigger event and custom events and javascript - trigger event and custom events, we talked about how to add/remove custom events and how to trigger them,...原创 2012-08-22 08:03:39 · 131 阅读 · 0 评论 -
javascript - trick to detect bubbling supportability
Event delegation is oe of the best techniques for developing high performance, scalable, web application. the basical idea is instead of directly bind to the elements they wish to watch - with event d...原创 2012-08-20 22:22:29 · 122 阅读 · 0 评论 -
javascript - trigger event and custom events
In the previous post - javascript - trick to handlers management we dicussed the handlers management and the important functions such as addEvent, removeEvent and the last triggerEvent which provides ...原创 2012-08-20 21:58:47 · 278 阅读 · 0 评论 -
javascript - trick to handlers management
We have discussed "javascript - trick to fix event object" and "javascript - trick to centralized store". with this two, we can build from and create a new set of addEvent and removeEvent methods (al...原创 2012-08-20 08:19:42 · 133 阅读 · 0 评论 -
javascript - trick to centralized store
For a number of reasons it's not advisable to bind an event handler directly to an element, you'll want to use an intermediary event handler instead and store all the handlers in a separate object....原创 2012-08-20 07:52:00 · 123 阅读 · 0 评论 -
javascript - trick to getText and setText
it is not as simple as you think to settext or get text to some element in javascript, by simply reading the textContent or write to the text content. Below show the code on the impl of get...原创 2012-08-14 07:40:32 · 137 阅读 · 0 评论 -
javascript - trick/guideline to remove DOM element
remove an element is not as simple as calling parent.RemoveChild, housekeeping include remove element should clean the handler that is associated with the element, otherwise, IE will leak me...原创 2012-08-14 07:00:49 · 159 阅读 · 0 评论 -
javascript achieve class like code with closure, prototype and etc...
Javascript is featured of something that is special among other object oriented or object based language, where you do not have class, and there is some mechanism which is called the prototype inherit...原创 2012-08-04 18:36:27 · 148 阅读 · 0 评论 -
javascript instantiation and arguments.callee
in the nutshell, it is no difference between a constructor and function, because a constructor is essentially a function. however, if you just give user a raw constructor, there is no way for the ...原创 2012-08-02 21:21:38 · 150 阅读 · 0 评论 -
javascript HTMLElement prototype
In newer version of Internet explorer, Opera and Firefox, I think the Chrome as well. has the prototype for HTML element. so by which, the HTML element is represented by some base functions. s...原创 2012-08-02 08:23:29 · 759 阅读 · 0 评论 -
javascript to know the function of the constructed object instance
Javascript is a dynamic type function. you cannot do something like reflection in other strong langauge. though you cannot do something like typeof(obj), while you can test if a function is t...原创 2012-08-02 07:48:09 · 104 阅读 · 0 评论 -
javascript memoization
I am using the word, memoization, because it is cool and it sounds like a buzzword, and author of the javascript ninja also called it so. so, what is memoization. " Memoization is the process o...原创 2012-08-01 22:23:39 · 198 阅读 · 0 评论 -
Javascript partially applied function
partially applying a function returns a new function which you can call. Which could be very useful in a lots of situations. Below is an exapmle that uses the partially applied functions, th...原创 2012-08-01 22:03:38 · 125 阅读 · 0 评论 -
javascript closures and function contexts
Javascript has four kind of functions, namely global function constructorprototype closureI may be wrong about the types, but the rule of thumb is that the functions differs from each o...原创 2012-07-31 08:13:43 · 104 阅读 · 0 评论 -
Javascript divide and load multiple .js files
It is a common practise to divide the programming code into multiple files. the same principle/rule/doctrin also applies to Javascript. you may have a .htm file and several modules, each module...原创 2012-07-29 21:17:36 · 156 阅读 · 0 评论 -
javascript subclassing native objects
You can subclass native object, the most often sub-classed object is the Object class itself. Let's first see some cases that you do with sub-classing the object class. Object.prototype.k...原创 2012-08-04 23:08:15 · 118 阅读 · 0 评论 -
javascript divide long operation into sub operations to improve responsiveness
nowadays the browser is much more smarter and they normally possed some features that intelligently monitor the status of the web applications. If some process overruns, say, 5 seconds non-stop (brow...原创 2012-08-05 20:19:33 · 101 阅读 · 0 评论 -
javascript - trick to clone an element
it should worth an article specifically for this topic to clone some elements, most of the cases should be fairly straight forward to clone some elements. However, the complication comes with the...原创 2012-08-13 22:16:31 · 120 阅读 · 0 评论 -
javascript - trick to evaluate javascript code in global scope
the reason why we have a dedicated session to have the tick to evaluete some javascript code inthe global context is that "The built-in methods for code evaluation are spotty, at best." It is a p...原创 2012-08-13 21:14:07 · 156 阅读 · 0 评论 -
javascript tips - assign uniqueness to elements
It is a common practice to make sure that each element of an array or an collection should be unqiue, application scenario including in the divide and conquer step, you may want to merge some array fr...原创 2012-08-11 21:51:32 · 121 阅读 · 0 评论 -
javascript CSS Selector engine.
CSS selecotor engine is a relative , new developement in the world of javascript but they've taken the world of libraries by storms. The premise behind the engie is that eyo ucan feed it in a C...原创 2012-08-11 15:51:07 · 326 阅读 · 0 评论 -
javascript the 'with' statement
The with() {} statement is meant to provide convenience. and there are some golden laws about the with() {} statement. it only use/assign existing propertiesit does not affect what i...原创 2012-08-07 08:43:05 · 116 阅读 · 0 评论 -
javascript the string.replace method and its use
string.replace method accept a regexpression as the seperator, also, you can pass some anonymous function which will work on each of the matched method; let's see the example. /********...原创 2012-08-06 22:09:30 · 114 阅读 · 0 评论 -
javascript async unit test framework
this is a rather simplied version of some asynchronous unit test framework, it is indeed far away from being able to be used as some real-world, production quality of unit test framework; however, it ...原创 2012-08-06 08:32:21 · 126 阅读 · 0 评论 -
javascript centralized timers
a centralized timers has benefit over non-centralized timers. the benefit including . 1. have one timers object that excute per page at a time. 2. you can start, stop, resume the timer 3. proc...原创 2012-08-06 08:29:05 · 126 阅读 · 0 评论 -
javascript - trick to cross browser DOM ready event
the "ready" event (implemented as DOMContentLoaded in W3C DOM-capable browsers). The ready event fires as soon as the entire DOM document has been loaded and is able to be traversed and manipulated...原创 2012-08-24 08:23:25 · 128 阅读 · 0 评论
分享