Short Tag – Web Development Blog

Entries for the ‘Javascript’ Category

Cancel action on a link (do not reload the window on click)

When you are developing using javascript it is often you get to the situation where you want to do something with javascript when the user clicks on the link. The problem is that when the user clicks on the link the browser will reload the window (and you don’t want that).
1.) Disable reload using HTML

<a [...]

JQuery and Innerfade (slideshow plugin)

Jquery is a library of Javascript functions and classes that can make Javascript programming a lot easier. Cross-browser Ajax means one line of code with JQuery. Animations, moving objects are easy to do with Jquery.
And it’s absolutely free!
Official website:
http://jquery.com/
Now… what is innerfade?
Innerfade is a plugin for JQuery. You can use innerfade for slideshows. Innerfade [...]

getElementsByClassName in Javascript

This is a function that returns all the elements in the page that have the given class name.
Returns an array with the objects.

function getElementsByClassName( strClassName, obj ) {
var ar = arguments[2] || new Array();
var re = new RegExp("\\b" + strClassName + "\\b", "g");

if ( re.test(obj.className) ) {
ar.push( obj );
}
for ( var i = 0; i [...]

Set cookie with javascript

Sometimes is useful to set a cookie with javascript. You can use the function below.

function Set_Cookie(name, value, expires, path, domain, secure )
{
var today = new Date();
today.setTime( today.getTime() );

if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; }
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + [...]

FCKeditor Delete functions

Recently I needed some delete functions for FCKeditor and I found this:
http://tgrove.com/2008/02/17/fckeditor-file-manager-delete-files-and-folders/
Quite handy functions, and they work too. You can choose to allow some functions or not, example here:
$Config['ConfigAllowedCommands'] = array(’QuickUpload’, ‘FileUpload’, ‘GetFolders’, ‘GetFoldersAndFiles’, ‘CreateFolder’, ‘DeleteFile’, ‘DeleteFolder’) ;