Posts Tagged ‘javascript’

PHP functions in Javascript

February 2, 2009david No Comments »

I like javascript, but I spend too much time wrting some functions just to use it more than once.  In most cases I uses prototype.js to create a shorter code but still being long. Recently I was porting some basic php functions to javascript like  isset(), array_keys(), in_array(), explode() and many more. I was very [...]

read More »

Powerful tools for manipulating images using javascript

December 4, 2008david 1 Comment »

Surfing on Internet for a while, I found a wonderful toolbox. These are a compilation of several script to manipulate images. This is the list:
busy.js: The library allows you to add/remove loading indicators to block-level elements on your webpages.
shiftzoom.js: Allows you to add/remove zoom and pan functionality to oversized images on your webpages.
sphere.js: Simulates a [...]

read More »

Limit textarea length using javascript

November 13, 2008david No Comments »

This is a simple code, but useful.
First, the javascript function:
function limit(n,id){
// n is the number of max characters
// id is the id of the textarea element
text = document.getElementById(id);
if(text.value.length >= n){
//alert("sorry, the text is too long");
text.value = text.value.substring(0, n-1);
}
}
Then, the [...]

read More »

} catch(err) {}