'white belt' category

Do not use the alert function in javascript

Picture yourself on a beautiful beach on a warm day. The sounds of the waves is music to your hears. You’re on a comfortable chair with a laptop on your knees connected via an incredible WiFi. You’re using a brand new web2.0 application that must be the gratest web site on the web. Then, you […]

Read the complete article...

How to use the self with object-oriented javascript and closures

When I began with object-oriented javascript, I always saw a self here and there without fully understanding what it meant.
Self?
When you see self in some object-oriented javascript, it’s just mean that the developer is using a closure that will reference the current object via a variable named self. Because self is a variable, it could […]

Read the complete article...

Our last project : Ecstatik!

Frank (of Ruby Fleebie) and I have been busy lately. We worked together on a project called Ecstatik!
What is Ecstatik!?
Ecstatik! is a project that caused Frank and I to be busy lately. But it’s not just that.
Ecstatik! is a digg-like for funny stuff. No more than that. We didn’t want to make the world a […]

Read the complete article...

How to use JSON

Web2.0 came with the intensive use of the XMLHttpRequest object even if it was already in our browser before then. A lot of format were tried but JSON will be the winner overall.
What is JSON?
JSON is a format for communication between the server-side (PHP, ASP.NET, …) and the client-side (javascript). The magic of it is […]

Read the complete article...

How to execute javascript code directly in your browser

This trick is not known by everyone though it is really simple.
The address bar
In the address bar, you simply write
javascript:/*some javascript code here*/;void(0);
As easy as that.
In fact, it’s the same thing as creating a link that executes some javascript code.
<a href=”javascript:alert(’Some code from a link’);”>Execute code from javascript</a>
The only thing I add is the void(0); […]

Read the complete article...

Mastering the date object in javascript

Javascript has a pretty basic Date object. It is cool but not as cool as in other languages. In fact, it is different but we like it anyway.
The primitive value
A date is nothing else than the number of millisecond since January 1, 1970 00:00:00. So now is 1 177 603 737 358.
When you create a […]

Read the complete article...

Do not use javascript for validations

This one will be widely accepted. The problem with it is that it’s so obvious that the question is asked here and there.
Javascript is not secure
I repeat : javascript is not secure. Your code is readable and it can be modified by anyone. It is great when you want to do a bookmarklet. It is […]

Read the complete article...

Do not use the innerHTML property on HTML objects

I already said Do not use the style property on HTML objects and as I was thinking how bad the innerHTML property can be, I considered doing an article on that subject. The problem was that stones were thrown at me after the first “Do not” article. Now I fear that this one may be […]

Read the complete article...

Javascript is not ajax

I see a lot of person talking about how ajax is cool and it helps you doing things that you couldn’t do before it was “invented”. What most of these people don’t know is that most of the coolest features are not ajax. Ajax is just a way to communicate between a client and a […]

Read the complete article...

Do not use the style property on HTML objects

Since ajax, a lot of people have to create HTML on the fly depending on response of the request. One mistake that I see a lot is that people are using the style property of their HTML objects. Why shouldn’t I do it?
The style property has a precedence on every style
Because the style property is […]

Read the complete article...