Web Design Forum: Skateside's Ramblings - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
 
- - - - -
The thing with JavaScript is that no-one learns it. Everyone just jumps in (these days with copy-and-paste jQuery plugins) and struggles to take that knowledge further and learn more about the language. In this post I'll describe my the key moments I've had ("JavaScript epiphanies" if you like) while learning; hopefully someone...
- - - - -

Number.prototype.times

Anyone who has ever worked with the PrototypeJS library will recognise this little beauty. It's a gem of an addition and something that I firmly believe should be added to the ECMAScript standard. It allows a function to be called a set number of times, such as the following example:

[codebox]var n = 4;
// This will alert 0, then 1, 2 and...
- - - - -
I'm not talking about commenting your code, although you should be doing that anyway. JavaScript has the ability to create HTML comments:

var comment = document.createComment('the comment itself');
document.getElementById('foo').appendChild(comment);

You can even do it in...
- - - - -
I often find myself looking at certain things that the major libraries do and thinking "I wonder how they do that?" Animation was one of those, so I looked through jQuery and YUI to see how they did it, built my own animation function to teach myself and now that it's working, I'll show everyone else how it works.

When I first...
- - - - -
Have you ever had a client that explicitly asked for rounded corners and drop shadows on their design? It's a royal pain in the ... well, it's a royal pain. Every modern piece of CSS you want to use: box-shadow, box-radius, [font="Courier...
- - - - -
I've made this mistake myself so I'm desperate to ensure it doesn't happen again. If you're going to patch JavaScript, please only do it to standards.

Whoa, just a second... patch?
JavaScript allows us to patch it, to fill in any missing pieces of functionality that aren't supported by the current browser. Now that...
- - - - -

Clone many rows

This is a technique that I've had to use a few times this week. It's remarkably handy when you need to do a lot of DOM manipulation at once.

Think of the following scenario: your client (or boss) has asked you to build a form. Diligently you build it using the latest in form-building theories and jQuery-based validation. Then, right at...
- - - - -
I just found a quick-and-easy trick when you're binding events to inputs.

If you've got an input and you which to bind functionality to it (say an auto-suggestion list or a username check), you probably don't want the functionality to fire every time a key is pressed. Otherwise users will press the shift key or a cursor key, it could...
- - - - -
I haven't written one before, but it seems like the cool thing to do, so I've started. My library is designed to add the ES5 methods to all browsers that don't understand them. It's also supposed to be easy to expand and modify so anyone can add their own methods. At the moment it will only work on standard JavaScript types...
- - - - -
I came across a fun little problem when I was playing around with JavaScript a couple of days ago: how do you compare 2 arrays? Comparing variables is usually easy, but comparing arrays (or objects for that matter) is a much trickier business. Let me show you can I mean:

[codebox]var myString = 'hello world',
myArray =...
 

  • 2 Pages +
  • 1
  • 2

Recent Entries

Recent Comments

May 2012

S M T W T F S
  12345
6789101112
13141516171819
20 21 2223242526
2728293031