Why you should stop using onload method.

8 Comments

onload1 276x300 Why you should stop using onload method.

Onload

It is amazing that many web developers still use onload method embedded in the BODY tag, like


 <HEAD>
 <BODY onload="document.contact.userID.focus();">
  <form name="contact">
   <input type="text" name="userID" >
  </form>
  </BODY>
 </HEAD>

There are two problems with this line of code.

  1. Embedding code (behavior) with HTML (structure) makes it difficult to maintain the page.
  2. onload() method will executes only after the page is fully displayed.
  3. Let’s see how to fix these problems. More

article clipper vert Why you should stop using onload method.
 

Nine Must Have JavaScript Tools For Every Web Developer

2 Comments

Almost all major web development projects include some javascript. Developing Javascript may be easy for some but working around various browsers’ incompatiblities makes it a bit more tedious chore. As a developer I always welcome the opportunity to use development tools that may help in the development process. Following is a list of some useful Javascript tools that I believe every web programmer should have at his or her disposal.
More

article clipper vert Nine Must Have JavaScript Tools For Every Web Developer
 

How to display RSS feed on your website.

2 Comments

rss m How to display RSS feed on your website.
Image credit:Kyle Wegner

OK, admit this. You have a nice-looking website. The color and the graphics look pleasing
to visiting eyes. But you do not get a lot of loyal visitors. The problem may not be your design,
it may be the static content that is turning the visitors off. If you do not update your website regularly, you may not attract enough repeat visitors. One way to juice up your website is to display RSS feeds from other relevant and reputable websites. Don’t know how to incorporate the RSS feeds into your website? Here is what you need: More

article clipper vert How to display RSS feed on your website.
 

Create awesome 3D photo gallery with TiltViewer

3 Comments

Last week I got a project to create a slideshow for a website. My first choice was to go with famous and somewhat ubiquitous LightBox. I actually started creating the slideshow using LightBox but then I thought there must be some other alternative. I am not saying LightBox is not good it’s just too common. So I started searching for LightBox alternatives and I found several other slideshow generators. But the one that stood out from the pack was TiltViewer.

TiltViewer is a free, customizable 3D Flash image viewing application. TiltViewer presents your photos in a modern and attractive style. Rather than sequentially displaying images TiltViewer allows your visitors to interact with your images. It almost gives life to your photos. User can zoom in and out of the photos or flip them to view more information about the images.
More

article clipper vert Create awesome 3D photo gallery with TiltViewer
 

Validate U.S Phone Numbers using JavaScript Regular expression.

15 Comments

279804967 668397cde9 m Validate U.S Phone Numbers using JavaScript Regular expression.
Photo credit: aussiegall

Continuing with our JavaScript regular expression series today we will discuss JavaScript regular expression to validate U.S phone number. Previously we talked about validating email , Social Security number and zip code using JS regex.

In today’s post I’ll show you how to use JavaScript regular expression to validate U.S phone number.


Although in this article we are discussing U.S phone number format I am sure this can be applied to other phone number formats with little or no change.

Let’s begin by looking at the JavaScript code.


function validatePhoneNumber(elementValue){
var phoneNumberPattern = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
return phoneNumberPattern.test(elementValue);
}

Explanation:

The argument to this method is the phone number you want to validate.

In the method body we define a variable (‘phoneNumberPattern’) and assign a regular expression to it.

Phone Number format: The regular expression for phone number is More

article clipper vert Validate U.S Phone Numbers using JavaScript Regular expression.
 

Validate Zip code using JavaScript Regular expression

7 Comments

zipcode 300x199 Validate Zip code using JavaScript Regular expression

Zip Code

Continuing with my series of JavaScript regular expression today we will see how easy it is to validate zip code using regular expression in JavaScript. Previously we talked about validating email and Social Security number using JS regex.

In today’s post I’ll show you how to use JavaScript regular expression to validate zip code. Let me first show you the JS code.


function validateZipCode(elementValue){
    var zipCodePattern = /^\d{5}$|^\d{5}-\d{4}$/;
     return zipCodePattern.test(elementValue);
}

Explanation:

The argument to this method is the zip code you want to validate.

In the method body we define a variable (‘zipCodePattern’) and assign a regular expression to it.

ZipCode format: The regular expression for zip code is

More

article clipper vert Validate Zip code using JavaScript Regular expression
 

Sort numbers in Javascript array

4 Comments

numbers Sort numbers in Javascript array
Sorting an array in Javascript is a snap.
You create an array and then call sort() method on that array. The Javascript sort() method sorts an array in lexicographical order. This method is very useful in sorting alphanumeric values of an array.

However, sort() will not work if the array consists of numeric values. Because the alphabetical order of numbers is different from their numeric order the sorted array may not be in the order you are expecting. For example, in a dictionary sort the number “11″ would come before number “5″. This may not be the result that you are looking for.
Here is an example

var ages = new Array (23,6,2,16,48,9,6);
ages.sort();

The array will become (16,2,23,48,6,6,9)

Fortunately, the work around for this problem is quite simple.
More

article clipper vert Sort numbers in Javascript array
 

#1 Programming Language – Java

No Comments

According to TIOBE Programming Community Index Java is still the #1 programming language.

TIOBE Index gives an indication of the popularity of a programming language and is updated monthly.
The ratings are calculated by counting hits of the most popular search engines.
Ruby moved up from 13th to 10th position.

Following is the list of top 10 programming languages.
1. Java
2. C
3. (Visual) Basic
4. C++
5. PHP
6. Perl
7. C#
8. Python
9. JavaScript
10. Ruby

For complete results visit TIOBE website

article clipper vert #1 Programming Language   Java
 

Dynamically loading an external JavaScript or CSS file

No Comments

A very good article explaining how to load JavaScript and CSS files asynchronously and on demand.

Dynamically loading an external JavaScript or CSS file

article clipper vert Dynamically loading an external JavaScript or CSS file