post

Label Inside Textbox That Disappears On Focus, With Javascript

You might have come across many websites that have fields that display the label of the filed within the filed. The most common among this is the search box. Many websites also uses this technique with the registration forms and other forms. When user selects a field to enter text, the label disappears. The advantage of this technique is that it conserve space and also make the website design cleaner.

There are many techniques that can be used to achieve this. Here I will take you through one way of doing it. I will demonstrate two types of fields that use this technique. One is a regular textbox and the other is a password textbox that switches between regular display characters when displaying label and masked characters when entering password. This simulates a login form where the username and password fields are prefilled with their associated labels and the labels disappear once the user click the field to enter text. The password field changes display to the expected password character masking mode.

There are two javascript functions that are used to get the job done. One function (HideLabel) hides the label when the textbox get the focus, either when the user clicks the textbox to enter text or by any other means. The second function (ShowLabel) show the label of the field (relabel) if the user leave the textbox empty and move on.

function HideLabel(txtField){ if(txtField.name==’username’){ if(txtField.value==’Username’) txtField.value = ”; else txtField.select(); }else if(txtField.name==’password’){ if(txtField.value==’Password’){ txtField.value = ”; txtField.type = ‘password’; } else{ txtField.type = ‘password’; txtField.select(); } }}function ShowLabel(txtField){ if(txtField.name==’username’){ if(txtField.value.trim()==”) txtField.value = ‘Username’; }else if(txtField.name==’password’){ if(txtField.value.trim()==”){ txtField.value = ‘Password’; txtField.type = ‘text’; } }}

Now finally we need to call the appropriate functions at appropriate time. We will call the ‘HideLabel’ function when the filed receive focus and call the ‘ShowLabel’ when the filed loose the focus.…

post

Flash Actionscript 3.0 – Retrieve Directory URL Of The SWF File

Usually when you want to load a resource like an xml or picture file from an SWF file you either specify the relative path or the absolute path to the resource. The relative

path is the path that the resource is in relation to the SWF file (eg: ‘/images/picture.jpg’). The absolute path is the URL to the file (eg: ‘http://www.yourdomain.com/rrs.xml’). The relative path is often very convenient that when all the resources are placed in the same directory or in sub directories as the SWF file, then moving the whole thing don’t require us to edit any path to the resources.

When embedding the SWF file in a theme or file that is loaded by other scripts, the directory of the SWF file is overridden by the directory in the main script is in. That is, if you specify a relative path to a resource from within the SWF file, it’s going to check for the resource from the directory where the main script is running and not from the directory in which the SWF is in. I first encountered this problem when I was developing a flash application for a WordPress theme that loads the configuration information from an XML file. All the files were places in the theme directory which were loaded by the main script.

The solution is pretty simple once you know it.

// * Get the URL of the file that loads the SWF file * //var SWF_URL:String = root.loaderInfo.url;// * Remove the name of the file that loads the SWF file thus giving the URL to the folder * //var SWF_Folder:String = SWF_URL.substr(0,SWF_URL.lastIndexOf(“/”));// * Append the Folder Url to the relative path of the file to be loaded * //ImageLoader.load(new URLRequest(SWF_Folder +”/Images/TheImageTobeLoaded.jpg “));…

post

Download Gradient Desktop-Wallpaper With Bokeh Effect

In Japanese language ‘bokeh’ means blur. In photography it stands for the blur circles that are formed generally in the background of a picture. This happens due to

the sharp focusing and the wide aperture of the lens. When I learned to make bokeh effect in Photoshop, I decided to make a wallpaper with this beautiful effect. As I am not an artist or graphic designer the out some many not be outstanding. If you are interested in downloading this desktop wallpapers you can download from the links below. The wallpapers come in two sizes, choose the one which is appropriate for you.…

post

Human Abduction Test


I have always been a fan of PIXAR animation studio. All their animation movies are creative and most of all, entertaining. This is an animation about a baby extraterrestrial being taking a test on human abduction. Human abduction is a scary phenomenon but here it is presented with humor. Watch it……

post

Synchronizing Pre-recorded Audio Narration With Microsoft Power-Point Slides


There are many ways to synchronize an audio narration with power-point slides. The first way is to record your narration as you play the slides (‘Slide Show’ tab, ‘Record Narration’). Microsoft Power-point will automatically record your voice and save the slide transition time thus synchronize the slides with the narration . This is the best and the easiest way to get the job done. But often this is not the case.

A second scenario is when you have a prerecorded narration or music to which you want to synchronize your slides. There are two methods to achieve this, first you can use the sound/audio file as a transition sound effect and the second method is to import the audio file into the PowerPoint. Both have their advantages and disadvantages. But I prefer the second method as it serves my purpose better. In both cases the transition of slides is controlled by preset time intervals at which the slides make the transition with respect to the previous slide transition.

1. Synchronize Slides With Audio As Transition Sound Effect

One method to synchronize a sound clip with slide is to set the intended sound file as a transition in the first slide. For this select the first slide and then go to the ‘Animations’ tab and select the ‘Transitions Sound’ dropdown box. From the dropdown box select the ‘Other Sound…’. This will popup the file browser from which you can select the sound file (.wav) that you want to have the slides synchronized to.

 

This method will only allow ‘.wav’ files to be added and this is one of the drawbacks. More over the wav file is way too big compared to an MP3 file. So it’s likely that it will be linked rather than embedded to the PowerPoint presentation.

 

The next step of synchronizing the slides is common to both the methods. It’s to set the time delay for each slide before it makes transition to the next one. This delay is in seconds. So the drawback is it won’t work as expected unless the whole presentation is played automatically without any interference.

2. Synchronize Slides With Imported/Inserted Sound/Audio Clip

This method only has a slight difference with the previous one. The difference is in how we use the sound file. This time we import the sound file and it supports MP3 files as well. To do this go to the ‘Insert’ tab, Press the down arrow below the ‘Sound’ Icon, which is in the ‘Media Clips’ Group. Then Press the ‘Sound from File’ option that pops up the file browser. Select the Sound file that you want and then it might ask you if you want the file to be played automatically or when the sound icon is clicked. If your presentation is automatic you need to have it start automatically.

 

Now you can either drag the sound icon out of the canvas to hide it or you can check the checkbox ‘Hide During Show’ in the ‘Options’ tab. The options tab will only be available once you click the Sound Icon. The ‘Maximum Sound File Size (KB)’ option enables you to change the size limit of the sound file that can be embedded in the presentation. If the file size is bigger than that size specified here then the file is only linked rather than being embedded. If the file is only linked then you must copy the linked files when you want to copy the presentation.

 

The next step of synchronizing the sound with the slides is the same as the previous method. Set the time delay for each slide before it makes transition to the next one.…

post

How To Adjust Textarea Label Position Without Table


If a label is placed next to a textarea the text will be place at the bottom line. Often this don’t look good. In this tutorial I will show how you can have the label placed anywhere along side the textarea as shown below.

 

The reason why I am writing this post is because when I searched for this solution I came across expert-exchange solution. But I couldn’t see the solution because I had to pay to see it. So I decided to find a solution myself. The solution is very simple, it’s simply using the positioning technique in CSS.

The code that I used for my comment section is as follows.

Comment

and the CSS styling is as follows. The ‘top’ position can be altered to adjust the label position.

.comment-form-comment { position:relative;} label[for=”comment”] { position:absolute; top:5px;…

post

Name of Country and their 2-Character Alphabetical Country Codes as PHP Key-Value array


Name of Country and their 2-Character Alphabetical Country Codes as PHP Key-Value array

March 2, 2009 at 00:43 – Files Under Programming, Uncategorized

 

Its quiet a tedious job when it comes to developing a dropdown input field in which the user have to select a county, as part of their address, Nationality, etc. Think if you have several of this fields in your form. When you want to change you have to change each and every one. More over, if you have to select one option depending upon user input or some database value, your will either have to have ‘if’ statement in every ‘<option>’ tag or use javascript to select the option when the page loads. As I am a lazy guy, decided to have an array containing the names of the countries as values and the 2 digit alphabetic country codes as key. Now you can see how easily you can add change and manipulate these select field.…

post

Online Photo Retouch With MugTug Darkroom


MugTug Darkroom is an online browser based application to retouch your photos. Its a simple application that gives your the basic features to retouch your photos. You can either upload a photo from your local disk or specify a url to an image (for example from picasa or flickr). Once you have finished editing your photo it can be download it to your local disk or save it at MugTug.

This application is very handy for people who travelling and have no access to an photo editing software. The application is cross browser compatible and hence accessible on Windows, Mac, Linux or any other OS that support the popular web browsers.…

post

USB Art Exhibision


Some very ingenious ideas that turned USB connectors into Art work. Images form such an exhibition.

Very creative. If it were a real USB drive, it will have a key lock access protection.

 

Male and female USB connectors. Perfect ring for couple.

 

 

One day we might have syringes that will inject date into human body.

 

You won’t forget the your USB drive if you tie your necktie.

 

Tin Can telephone

 

Connectivity around our waist

 

 

 

USB Razor?

 

Door Handle. Probably you need the encrypted password inside the USB for the door to open

 

Plug and dial telephone

 

 

 

Plug in your USB drive and step on delete to format the drive. He he

 …

post

Light weight, Opensource, Project Collaboration Software


Collabtive is a Project Management/Collaboration software that I have recently stumbled on. Its an open source, Light weight web application. What attracted me the most about this application is its elegant design. This is what many other applications in the same category is lacking. It has got all the essential features. Major features include:

  • Projects, Milestones, Tasks
  • Basecamp import
  • Timetracking, Reporting

Even if you are not dealing with a large project, it will be a good idea to use ‘Collabtive’ to define your mile stones and stick to the time frame.
A live demo of the application is available at http://collabtive.o-dyn.de/demo/

 

 

Main Page. Briefing on all activities

 

Projects

 

 

 

Project Calendar, an over view

 

Project Milestones

 

 

Documents and Files related with the project…