Welcome to Code Couch

Posts tagged with “ JavaScript ”

  • Speed up your Javascript

    Nicolas Zakas (of Professional JavaScript, Second Edition fame) has a series of articles discussing improving Javascript performance - avoiding browsers complaining about long-running scripts. Some useful suggestions on how to optimise and chunk interactions.

  • Replacement for “bind” or “bindAsEventListener” in jQuery

    Do you need to use the equivalent of Prototype's "bind" or "bindAsEventListener" in jQuery, passing through "this" context? Read on for more!

  • How to create rollovers without using Javascript

    Using just CSS, you can do simple (and more complex) rollovers... no javascript required. This post shows how to apply this technique to your own pages with ease - whether it's a colour change or a more complex image swap.

  • Enabling cross-site scripting XSS via an iframe

    Communication from an iframe that has content from a domain other than the one the iframe is contained within is a constant source of frustration - as browsers prevent this kind of activity due to built-in security policies. Here is a technique to perform cross-site scripting (XSS) in just such an environment with example code and a real-world example.

  • ReferenceError: console is not defined

    If you have recently upgraded to the free Firefox extension Firebug 1.2 - then you may have experienced some difficulties with console.log throwing the following: ReferenceError: console is not defined. Read on for an explaination...

  • Using AJAX to update the time on a web page from the server

    In an attempt to better explain how you can use AJAX to fetch some data from the server and display it on the web page, I have provided a self contained PHP file.

  • How to prevent page reloading with a non-submitted form

    This technique informs the user if they navigate away without submitting the form on the page (whilst letting them change their mind and remain on the page). Useful to prevent the loss of unsaved changes on a web form.

  • Tips on converting strings into numbers

    I recently ran into some strange behaviour using parseInt() to convert a string into an integer. It turns out that passing in the base (radix) of the number that the string prepresents is important to ensure the desired behaviour.

  • Creating a coloured gradient background without images

    If you want to dynamically create a gradient background without using images, this code does the job and is flexible for most needs.

  • What is Javascript?

    JavaScript is an object-based scripting programming language based on the concept of prototypes. The language is best known for its use in websites, but is also used to enable scripting access to objects embedded in other applications.