Flabby Rabbit | The offical home of The Rabbit

Archive for the "Javascript" Category

Firebug Lite in IE

Anyone who has tried to make their projects work on ALL browsers (including IE6 and 7) will know the headache that it can become. With no real developer tools available it can be incredibly difficult to trace and debug problems. When you start using Firebug in Firefox or Inspect Element in Chrome you quickly forgot [...]

Read More ›

Drag and drop targets with jQuery

Final result: http://www.bbc.co.uk/news/health-17235058

Read More ›

Multi line strings in Javascript

String concatenation is the most common method of formatting long strings in Javascript, but it isn’t the only or best way. For better performance try using backslashes to split up your lines. Backslashes var text = "I am a long string that I would\ like to split up on to multiple lines to keep my [...]

Read More ›

Quick and easy way to avoid CSS hacks

Probably the most incredibly useful snippet I have learnt recently. It’s beautifully simple and unbelievably essential. Creating websites for such a wide variety of platforms is hard enough but then when you throw IE6 and no script into the mix things can become very messy. Replace the tag with the following code and most of [...]

Read More ›

Using SSI effectively

Server Side Includes (SSI) is a simple interpreted server-side scripting language. SSI is mainly used to include files inside other files, much like PHP includes. Simple include: File: main.html <!–#set var="inc" value="/inc/header.inc" –> Using variables to include files: File: main.html <!–#set var="inc" value="/inc/header.inc" –> <!–#include virtual="${inc}"–> Passing variables to create dynamic includes using SSI and [...]

Read More ›

Random numbers

Want a random number, try this: var num = Math.floor(Math.random()*51); Result will be between 0-50, seeing as Math.random() returns a floating-point number between 0.0 and 1.0. So a simple script to get a random item in array: var num = Math.floor(Math.random()*theArray.length); alert(theArray[num]);

Read More ›

 

Essentials