JavaScript Required Form Field

The following script will alert a user when he or she tabs out of the email address field without entering anything.


Email address:

Name: (optional)

Script Source

<Under the head section>

<script language="javascript" type="text/javascript">

<!-- Hide scriptfrom old browsers

function fieldCheck(myField) {

if (myField.value == "") {

alert("You must enter your email address")


// End hiding script from old browsers -->

<Under the body section>

<form action="#">
Email address: <input type="text" onblur="fieldCheck(this)" /></br></br>
Name: (optional) <input type="text"/>


Please let me know if this script was helpful to you.



Duly Noted

When deciding for web hosting services, always take into account your web design. For instance, if your website has lots of images in it, you should rather go for a good image hosting site. Earning from ppc advertising is not that easier. Services of a cheap hosting site may not go well with the requirements of affiliate marketing campaigns. And web design development expertise is also a plus point for generating good revenues.