Here are a bunch of online tools I use to tidy, format and optimize code.
Continue reading “Online tools to tidy, format and optimize code” →
var element = document.getElementById( 'some_element_id' );
element.style.cssFloat = 'left';
A while ago, I came across a post on such a subject. It was written a few years ago but it’s still as relevant and useful as ever.
Simple one. If you need to add/remove escape slashes to/from a string, use the following code.
The floating menu is just an absolute div that is hidden from view.
The library is smart in the sense that it determines where best to display the menu. It works out where you have scrolled to on the page and figures out if there is space at the top or bottom and to the left or right of where ever your target co-ordinates are.
This is useful where you want to display a menu, or some div, but you don’t know (or care) where the menu is going to be needed on the page.
This function returns an encoded string where all non-alphanumeric characters except – _ . are replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs.
The escape function encodes all non-alphanumeric characters except * @ / + – _ .
The encodeURIComponent function encodes all non-alphanumeric characters except spaces and ! ‘ ( ) * ~
The winner for me though is encodeURIComponent as it encodes all UTF-8 characters while escape only encodes ISO Latin characters.
With this in hand, mozilla help provide a neat function.
I was looking into flash’s local shared objects ( from here on LSO’s ) recently as a method of data persistence on a clients browser as the plain old HTTP cookie has its limitations.
LSO’s are like cookies and are sometimes referred to flash cookies but there are 2 main differences between them. A normal HTTP cookie can store around 4k of data, while the flash cookie can store up to 100k. Also a normal cookie is pretty easy to remove while removing a flash cookie is far more convoluted, which is a matter of some contention.