Set focus on the first text field of HTML form.

1 Comment

A HTML form is a very good channel that you can offer to your visitors to contact you. An aesthetically appealing form encourages user to fill and submit it. It is equally important to make the form as user friendly as possible. Today I’ll share a small JavaScript function that will set the focus on the first editable text field of your form. So when the web page loads the users don’t have to click on the text field. They can just start typing as soon as the form loads.

Here is the JavaScript code.

function setFocus(){
 var flag=false;
 for(z=0;z<document.forms.length;z++){
  var form = document.forms[z];
  var elements = form.elements;
  for (var i=0;i<elements.length;i++){
    var element = elements[i];
    if(element.type == 'text' &&
      !element.readOnly &&
      !element.disabled){
      element.focus();
	  flag=true;
     break;
    }
  }
  if(flag)break;
 }
}

How to use this script.

Save the script in a text file and name it focus.js.

To use script copy and paste following line into the header section of your form HTML file.

<script type=”text/javascript” src=”focus.js”>

If you saved the focus.js to a separate directory, include the directory with the file name (like src=”js/focus.js”).

Now add

onLoad=”setFocus();”

to the body tag.
Your body tag will become

<body onLoad=”setFocus(‘contactForm’);” >

Now when your page loads the focus will be on the first editable textfield on your form.Click here to see an example.


article clipper vert Set focus on the first text field of HTML form.
 

Best tutorials by not so famous bloggers

3 Comments

Last week DailyBlogTips invited bloggers to write turtorials as part of DBT’s blog writing contest. I submitted my tutorial about Google Custom Search for blogs. In all, 71 excellend tutorials covering wide-ranging topics from blogging, montezing to health were submitted. This contest not only provided an opportunity for many bloggers to present their posts to a very receptive audience, it also benefited the readers by showcasing 71 very useful tutorials.
The interesting part of this contest is that the participants themselves are the judges. They will vote for best tutorials and the top 3 tutorials that receive most votes will win. Following is the list of my favorite tutorials.

I wish luck to all the participants. Many thanks to DBT for a great contest.


article clipper vert Best tutorials by not so famous bloggers
 

How to incorporate Google Custom Search engine with Adsense into your WordPress blog.

51 Comments

AdSense is by far the most popular and easy to use advertisement program for new bloggers. With AdSense you earn money when users click on the ads on your website. But the ads are not the only source of revenue for your blog. You can use AdSense for Search to to increase your revenue. But a better alternative to AdSense search is the Google Custom Search Engine. You can customize Google Search Engine to blend with your blog’s theme. You can also specify whether to search entire web or just your own website. It is more customizable than AdSense search and like AdSense for search you can earn money through Custom Search Engine.

In this tutorial I’ll show you how to setup Google Custom search engine and then incorporate it with AdSense into your WordPress blog.

To make things little easier I’ve captured screenshots of some of the screens that we will talk about in this tutorial. To view those screenshots click on the thumbnail images in the following sections. For performance issues I did not include the screenshots on this page but provided the links for easy access.

Now let’s get started.
More

article clipper vert How to incorporate Google Custom Search engine with Adsense into your Wordpress blog.
 

Improve your Alexa rank

3 Comments

If you are thinking of monetizing your new website you should consider imporving your Alexa rank. Most advertisers and advertising serives like Text Link Ads, Sponsored Reviews etc. use Alexa Rank to determine the worth of a link on your web site. Alexa rank is the level of traffic your site received from Alexa toolbar users. The better your Alexa rank is the better price you can get for publishing ads on your website. From Alexa website

What is Traffic Rank?

The traffic rank is based on three months of aggregated historical traffic data from millions of Alexa Toolbar users and is a combined measure of page views and users (reach). As a first step, Alexa computes the reach and number of page views for all sites on the Web on a daily basis. The main Alexa traffic rank is based on the geometric mean of these two quantities averaged over time (so that the rank of a site reflects both the number of users who visit that site as well as the number of pages on the site viewed by those users). The three-month change is determined by comparing the site’s current rank with its rank from three months ago. For example, on July 1, the three-month change would show the difference between the rank based on traffic during the first quarter of the year and the rank based on traffic during the second quarter.

Fortunately, it is not very difficult to improve (manipulate) your Alexa rank. DoshDosh has a list of 20 suggestions to improve Alexa rank. I don’t recommend that you try all 20 of those suggestions. I tried following simple tricks and my Alexa rank improved within weeks.
More

article clipper vert Improve your Alexa rank
 

How to validate email, SSN, phone number in Java using Regular expressions.

38 Comments


email 300x225 How to validate email, SSN, phone number in Java using Regular expressions.

Email

Regular Expressions offer a concise and powerful search-and-replace mechanism.
They are patterns of characters used to perform search, extract or replace operations on the given text. Regular expressions can also be used to validate that the input conforms to a given format.

For example, we can use Regular Expression to check whether the user input is a valid Social Security number, a valid phone number or a valid email number, etc.
More

article clipper vert How to validate email, SSN, phone number in Java using Regular expressions.
 

Vectorize your bitmap images, for free.

2 Comments


Vector Magic is a Stanford University research project for vectorizing raster (bitmap) images online.
vectorization horizontal narrow Vectorize your bitmap images, for free. This is a free online tool to convert bitmap images ( JPG, GIF, BMP, TIFF format) to vector images (EPS,SVG, PNG). This tool is similar to Adobe Illustrator’s Live Trace and CorelDRAW’s PowerTRACE but this one is free.

Check out the comparison page to see how this free tool outperforms these two leading commercial products.

The process of vecrotizing (tracing) is simple. You upload your image file and with a click of button you get a vectorized copy of your image. Save the image to your computer and you are done.

VectorMagic use cookies to keep a list of your last 30 images for 30 days.
So you can go back to your images later to view and revectorize them. You can share your images, stored on VectorMagic servers, with other people. You can either share your private link to the images that will enable them to modify the images on VectorMagic servers or just share a view only link.

article clipper vert Vectorize your bitmap images, for free.