Archive for the ‘Webdesign’ Category.
October 31, 2011, 6:13 pm
The error looks like: c.widget is not a function Or: d.widget is not a function I get this error when I do theming or module development for Drupal. Basically this tells you that the file jquery.ui.widget.js is missing. check the code you were writting and add that file to Drupal like this: drupal_add_js(‘misc/ui/jquery.ui.widget.min.js’);
January 1, 2010, 5:49 pm
After the release of Opera 10.5 Alpha, it’s now be possible to rotate elements, this new release includes support for CSS3 rotation and other transitions and transforms, we may not longer need JavaScript for some basic transformations, have a taste: Download Opera 10.5 Alpha See the demonstration The demonstration doesn’t show rotation, so the CSS [...]
December 17, 2009, 11:59 pm
This is a small library I wrote for creating simple and complicated easing effects without using JQuery, MooTools or other JS libraries. The library is small 13.4 KB or 5.6 KB compressed, The function can be called as follows: tween(element, property, from, to, duration, [optional] function) Parameters element: The idĀ of the HTML element you [...]
August 24, 2009, 7:09 am
The best you can do with built in JavaScript functions is to round a number to the nearest integer using the method Math.round(x), so to round a float to n decimal points we need to come up with our own function. The function round_float() rounds a floating point number x to n decimals, if you [...]
August 10, 2009, 2:21 am
The JavaScript methods setAttribute and getAttribute are very handy when you are designing dynamic effects for your website, but those methods have a lot of bugs in IE (6 an 7 at least), I use these two crossbrowser functions as alternatives instead of using directly setAttribute() and getAttribute(), I’ve been using them for quite a [...]
August 5, 2009, 6:35 am
This also was about to drive me crazy so I will not let it go without writing about it.. Let’s say you have some long HTML code contained on a PHP variable, something like this <?php $some_div = ‘ <div id=”box”> <h1>Title</h1> <p>Article contents + comments</p> <div>’; ?> Now you want to use this HTML [...]
August 5, 2009, 4:19 am
I use PHP a lot in my projects and it happens that sometimes I combine PHP with another language and write completely useless code. PHP arrays can be created and initialized with like this: <?php $cities[] = “mecca”; $cities[] = “medina”; ?> I thought that the same would apply to javascript… Yes, it can work, [...]
June 6, 2009, 3:56 am
The function generatePassword() is a simple yet customizable function that generates a random password string, the default password length is 6, you can override it by calling the function like thisĀ generatePassword(n) where n is the password length. The possible characters are defined within the function with the variable chars The function: generatePassword([len=6]) function generatePassword(len){ [...]
June 5, 2009, 11:13 am

There are situations where you need to style input fields depending on there types. Doing this is wrong: input{ border:solid 1px red; } As you see in the image, the CSS rule has been applied to all input fields (a text input field, and an image input) You can specify the type of input field [...]
May 5, 2009, 1:54 am
Maths Ok, so you already know how to generate positive rondom numbers but let’s do it again: To generate a random number varying from 0 to 9 we will use this code: var randomN = Math.floor(Math.random()*10) This expression on the right of the “=” produces a random number from 0 to 1 (excluding 1, say [...]