JavaScript

Articles from this section are focused on Javascript and AJAX. You will find here useful information about popular JavaScript libraries such as jQuery or Prototype.

How to capitalize word with JavaScript

Generally it is better not to interfere with the textual content from JavaScript, but if we ever had to capitalize a word, this is a very cool way to do it:

Accessing iFrame content from parent HTML page using jQuery

I got stuck on this one once, so I decided to write my own article.

To access the content of any iframe on your html page, you can use following:

$('#frameID').contents().find('#someElement').html();

Note, both iframes must be hosted on the same domain, otherwise you will get error, similar to this one:

Error: Permission denied for <http://localhost> to get property HTMLDocument.nodeType from <http://www.example.com>.

Neat workaround for this issue is described on Michael Mahemoff's blog, in article Cross-Domain Communication with IFrames.

How to create custom selectors in jQuery?

jQuery's selectors engine is one powerful piece of DOM parsing tool. It allows to easily select HTML objects based on the tag name, ID, class, or any other attribute we want. Using jQuery selectors we can significantly speed up development and make our life easier.

One of the interesting things about jQuery is the fact, we can write our own, fully customized selectors. Example below shows how can we archive that by extending standard class. In my example, I create my own custom selector, to select all elements with font color set as "red" or "blue".

Conway's Game of Life in JavaScript

Introduction

Conway's Game of Life is an example of cellural automation. It was created by British mathematican John Horton Conway in 1970, and according to wikipedia it is "best-known example of cellurar automation".

Syndicate content
served by y.co.uk