Archive for category Javascript

Hover effect on input element in IE6

If you have ever tried to put a hover effect on any input element (submit, button etc) using css you must have faced the problem when you tested on IE6. Generally following is the css code we use to add the hover effect: input.inputClass{background-color:#cccccc;color:#000000;} input.inputClass:hover{background-color:#000000;color:#ffffff;} This would change the background color and text color of […]

, , , ,


Simple Javascript Validation for Checkbox

There are times when we need to add javascript validation to check if at least one of a group of checkbox options has been checked. Here is a simple function that’ll solve the problem and works in most of the browsers. <html> <head> <title>Imran’s checkbox validation</title> <script language=”javascript”> //frm is the form element function checkForm(frm){ […]


Javascript – Ajax file upload using Yahoo API

Web user interfaces have been very dynamic after the introduction of AJAX. People are now more used to with pages that do not refresh on every click. For developers it has been a challenge to build sites that are more user friendly and to achieve that file upload without refreshing the page is a big […]



Show pound sign in input field by Javascript

If you have ever tried to put pound sign (or any special character) in any input fields by Javascript, you know that it is not that straight forward. If we write code like this, document.getElementById(‘input_field_id’).value = ‘£1000′; It’ll display some question mark(unrecognized character) instead of the pound sign. So we need to put character’s unicode […]



Javascript – Round numbers to some decimal places

Javascript’s Math.round function allows a user to round a float to an integer. But most of the time we need some function that’ll let us round the number to any decimal places we want. So here is the function that’ll solve your problem: function roundNumber(num,decimal){ var numerator = Math.round(num * Math.pow(10, decimal)); var denominator = […]


No Comments

Javascript Beginners – Select a dropdown option by value

A very simple and common issue a Javascript newbie often faces is how to select a dropdown option dynamically by value. People who are working for long with Javascript would solve it in minutes, but hey, this is for a newbie, remember? So this is a simple function I wrote to do the work. function […]

, ,