Category Archives: javascript

Triggering the Source Code view of the current page using JavaScript

I was recently writing a demo to showcase the new Google Language API, and in my demo I did the usual thing of instructing users to View > Page Source in order to view the source code and comments. I know this is less than ideal, because it forces users to have to process the [...]

Recommended Mozilla Firefox add-ons (aka extensions, aka plugins)

This is a list of my "must-have" Mozilla Firefox add-ons. If you can recommend anything similar or better, be sure to drop me a comment. Page Analysis & SEO Minimise Nuisance Bookmark Management Download Management Productivity Web Development & Design Security Functional Extensions Tab Management Add-Ons Management Page Analysis & SEO About This Site Bookmarks [...]

Class Inheritance in Javascript

My previous post showed how to create classes in Javascript. This addendum post shows how to create an inherited class from a parent class. The concept is simple. Declare and define your parent class Declare and define your child class without defining the parent-child relationship Add a new instance of your parent class to your [...]

Creating classes with Javascript

Javascript is a prototype-based language rather than a class-based language (e.g. Java). For an explanation of the difference, see Mozilla's comparison of class-based and prototype-based languages. In short, in a class-based language, objects are created by instantiating classes. The classes' list of properties and methods cannot be altered (e.g. added to) at runtime. A prototype-based [...]

Add list items to a list via the DOM

PLAIN TEXT JavaScript: //Create new list element var new_item         = document.createElement('li'); var new_item_label = document.createTextNode(title); new_item.appendChild(new_item_label); new_item.id = '467894sfs6f579f4sa6';   parent_container.appendChild(new_item); Tweet