Sunday, November 29, 2009

Get screen resolution in JavaScript

How to get screen resolution in JavaScript?


 You can get your screen resolution/ screen width and height using following JavaScript. It shows you the screen resolution of your computer screen in pixel. When designing web application for different screen sizes this may be very useful.


HTML and JavaScript Code
<head>
<title>Screen Resolution</title>
<script type="text/javascript" language="javascript">
function getScreenResolution(){
                var width=screen.width;
                var height = screen.height;
                document.getElementById("txt_screen_width").value=width;
                document.getElementById("txt_screen_height").value=height;
}
</script>
</head>
<body onLoad="javascript:getScreenResolution();">
<form id="form_screen_resolution" name="form_screen_resolution" method="post" action="">
  <table width="200" border="0">
    <tr>
      <td colspan="2" align="center"><strong>Screen resolution </strong></td>
    </tr>
    <tr>
      <td>Width</td>
      <td valign="middle">
        <input name="txt_screen_width" type="text" id="txt_screen_width" size="5" />
        px      </td>
    </tr>
    <tr>
      <td>Height</td>
      <td valign="middle">
        <input name="txt_screen_height" type="text" id="txt_screen_height" size="5" />
        px      </td>
    </tr>
  </table>
</form>
</body>
</html>

Limit characters in textarea

How to limit the number of characters entered in a text box or text aria in JavaScript?

Following example shows you how to limit characters in a text area in javascript as a client side validation.


In some cases you may want to limit number of input characters in a text box or text aria. In such situation you can use a very simple JavaScript to do it. In HTML there is no way to limit the input characters in a text box or text area. Using following JavaScript you can limit the input character length as client-side validation. This JavaScript works on onkeyup event of the text box / text area. When user entered a character from the keyboard it counts the total length of the text you have entered. It shows a message when you are tried to enter a single character more than the character length you defined.




Demo- Limit characters in a text area using JavaScript.
JavaScript Character Counter
1.Enter description (50 characters only).
Characters remaining view code
2.Limit characters in a text area.
Enter number of characters you want to limit.
Enter your text here
Characters remaining view code


Try it!
Bookmark and Share

1. Example code for limit number of input characters in a text area using JavaScript.

JavaScript Code
<script type="text/javascript" language="javascript"> <!-- function limitInputCharacters(inputText,limit){ var text=inputText; if(text.length>limit){ alert("You have entered more than "+limit+" characters!"); document.getElementById("txtLimitCharacters").value=text.substr(0,limit); return false; } document.getElementById("charactersRemaining").value=(limit-text.length); return true; } --> </script>
Html Code
<html> <head> <title>How to Limit Characters in a Text Area </title> </head> <body> <table border="0"> <tr> <td valign="top"> 1.Enter description (50 characters only). </td> <td align="left"> <textarea name="txtLimitCharacters" cols="40" rows="8" id="txtLimitCharacters" onkeyup="javascript:limitInputCharacters(this.value,50);" ></textarea> </td> <td align="left">&nbsp;</td> </tr> <tr> <td align="right">Characters remaining </td> <td align="left" > <input name="charactersRemaining" type="text" id="charactersRemaining" disabled="disabled" size="5" /> </td> <td align="left"> </td> </tr> </table> </body> </html>

2. Limit user input text using JavaScript.

<script type="text/javascript" language="javascript"> <!--
function limitCharacters(inputText){ var text=inputText; var characterLimit=document.getElementById("numberOfCharacters").value; if(!isNaN(characterLimit)&& parseInt(characterLimit)>0){ if(text.length>characterLimit){ alert("You are only allowed to enter maximum "+parseInt(characterLimit)+" characters only"); document.getElementById("javaScriptCharacterCounter").value=text.substr(0,characterLimit); return false; }else{ document.getElementById("charactersRemaining2").value=(characterLimit-text.length); } }else{ alert("Please enter valid integer value for\nCharacter limit"); document.getElementById("numberOfCharacters").value="50"; document.getElementById("javaScriptCharacterCounter").value=""; document.getElementById("numberOfCharacters").focus(); return false; } } </script>
Html Code
<html> <head> <title>How to limit user input text in text area </title> </head> <body> <table border="0"> <tr> <td align="right">Enter number of characters you want to limit. </td> <td align="left" ><input name="numberOfCharacters" type="text" id="numberOfCharacters" value="50" size="5" /></td> <td align="left">&nbsp;</td> </tr> <tr> <td align="right">Enter your text here </td> <td align="left" ><textarea name="javaScriptCharacterCounter" cols="40" rows="8" id="javaScriptCharacterCounter" onkeyup="javascript:limitCharacters(this.value);" ></textarea></td> <td align="left">&nbsp;</td> </tr> <tr> <td align="right">Characters remaining </td> <td align="left" ><input name="charactersRemaining2" type="text" id="charactersRemaining2" disabled="disabled" size="5" /></td> <td align="left"> </td> </tr> </table> </body> </html>
» How to get screen resolution in JavaScript
» How to limit characters in textarea using JavaScript
» How to validate decimal number in JavaScript
» How to validate an email address in JavaScript
» How to validate date using JavaScript
» JavaScript String functions
» How to validate multiple select list box in JavaScript
» How to generate random numbers in JavaScript
» How to validate multiple check box in JavaScript
» How to validate user login in JavaScript
» How to validate drop down list in JavaScript
» How to validate radio button group in JavaScript
» How to create JavaScript alerts
» How to create popup windows in JavaScript
» How to count words in a text area using JavaScript
©-Copyright By Duminda Chamara JavaScript Validation

Sunday, November 22, 2009

Validate Decimal Number


How to validate decimal number using JavaScript?




Following example shows you to validate a decimal number in javascript as a client side validation




In some situations you may want to validate a decimal number before submitting your form. It is good practice to validate input data before they sent to the web server. Using a simple javascript you can validate a decimal number. A decimal number contains 0 to 9 integer values and only one decimal point. There is an in-built function isNaN() that can use to validate a decimal number in javascript.
Using following javascript you can check
whether a particular number is a valid decimal number of not.


Demo- Validate Decimal Number In JavaScript
1. Validate decimal number.
Enter a Decimal Number




view code



2. How to validate a decimal number on key press event.



Enter a number

view code



3. Use following code to validate a decimal number with specified decimal places.



Number of Decimal Points

view code
Enter Decimal Number







Enter a value and click on submit button to test whether input is a valid decimal number or not. If you enter an invalid decimal number JavaScript alerts you, you have entered an invalid number. Otherwise it alerts the input is a valid decimal number.







Bookmark and Share


1. Example code for validate a decimal number in JavaScript.

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

<!--

function validateDecimalNumber(){

var value = document.getElementById("textDecimalNumber").value;

var message = "Please enter a decimal value";

if(value!=""){

if(isNaN(value)==true){

alert(message);

return false;

}else{

alert(value+" is a valid decimal number");

return true;

}

}else{

alert(message);

return false;

}

return false;

}

-->

</script>
Html Code


<html>

 <head>

  <title>How to Validate Decimal Number in JavaScript </title>

 </head>

<body>

<table border="0">

<tr>

<td>Enter Decimal Number </td>

<td>

<input name="textDecimalNumber" type="text" id="textDecimalNumber" />

</td>

</tr>

<tr>

<td>&nbsp;</td>

<td>

<input name="btnDecimalNumberValidator" type="submit" id="btnDecimalNumberValidator" onclick="javascript:validateDecimalNumber();" value="Validate" />

</td>

</tr>

</table>

</body>

</html>

2. Example code for validate a decimal number on key press event in JavaScript.

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

<!--

function validate(){

var value = document.getElementById("txtDecimal").value;

var message = "Please enter a decimal value";

if(isNaN(value)==true){

alert(message);

document.getElementById("txtDecimal").select();

return false;

}else{

return true;

}

}

-->

</script>
Html Code


<html>

 <head>

  <title>How to Validate Decimal Number in KeyPress Event in JavaScript </title>

 </head>

<body>

<table border="0">

<tr>

<td>Enter Decimal Number </td>

<td>

<input name="textDecimalNumber" type="text" id="textDecimalNumber" />

</td>

</tr>

<tr>

<td>&nbsp;</td>

<td>

<input name="txtDecimal" type="text" id="txtDecimal" onkeyup="javascript:validate();" />

</td>

</tr>

</table>

</body>

</html>

3. Custom Decimal number validation using JavaScript.

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

<!--
//------------------------------------------------------------------

function showDecimalPointError(){

var message="Please enter an integer value";

alert(message);

document.getElementById("textDecimalPoints").value="2";

return false;

}

//------------------------------------------------------------------

function CheckDecimalPoints(){

var decimalPoints=document.getElementById("textDecimalPoints").value;



for(var x=0;x<decimalPoints.length;x++){

if(decimalPoints.charAt(x)=="."){

showDecimalPointError();

}

if(isNaN(decimalPoints.charAt(x))){

showDecimalPointError();

}

}

return true;

}

//------------------------------------------------------------------

function customValidation(){

var preferredDecimalPoints=document.getElementById("textDecimalPoints").value;

var decimalPointCount=0;

var decimalNumber = document.getElementById("txtCustomValidation").value;

var pointFound=false;

var decimalPlaces=0;



for(var i=0;i< decimalNumber.length ;i++){

var _char=decimalNumber.charAt(i);



if(pointFound==true){

decimalPlaces++;

}

if(_char=="."){

pointFound=true;

decimalPointCount++;

if(decimalPointCount>1){

break;

}

}else if(isNaN(_char)){

setError()

return false;

}

}

if(decimalPointCount!=1){

setError()

return false;

}else if(decimalPlaces!=preferredDecimalPoints){

setError()

return false;

}else if(isNaN(decimalNumber)){

setError()

}else{

alert(decimalNumber+" is a valid decimal number");

}

return true;

}

//------------------------------------------------------------------

function setError(){

var message="Please enter a valid decimal number";

alert(message);

document.getElementById("txtCustomValidation").select();

document.getElementById("txtCustomValidation").focus();

return false;

}

//-------------------------------------------------------------------->

</script>
Html Code
<html>

 <head>

  <title>How to Validate Decimal Number in JavaScript </title>

 </head>

<body>
<table border="0">

<tr>

<td>Number of Decimal Points </td>

<td><label>

<input name="textDecimalPoints" type="text" id="textDecimalPoints" size="5" value="2" onkeyup="javascript:CheckDecimalPoints();" " />

</label></td>

</tr>

<tr>

<td>Enter Decimal Number </td>

<td><label>

<input name="txtCustomValidation" type="text" id="txtCustomValidation" />

</label></td>

</tr>

<tr>

<td>&nbsp;</td>

<td><label>

<input name="btnCustomValidation" type="submit" id="btnCustomValidation" value="Validate" onclick="javascript:customValidation();" />

</label></td>

</tr>

</table></body>

</html>


 »   How to get screen resolution in JavaScript
 »   How to limit characters in textarea using JavaScript
 »   How to validate decimal number in JavaScript
 »   How to validate an email address in JavaScript
 »   How to validate date using JavaScript
 »   JavaScript String functions
 »   How to validate multiple select list box in JavaScript
 »   How to generate random numbers in JavaScript
 »   How to validate multiple check box in JavaScript
 »   How to validate user login in JavaScript
 »   How to validate drop down list in JavaScript
 »   How to validate radio button group in JavaScript
 »   How to create JavaScript alerts
 »    How to create popup windows in JavaScript
 »   How to count words in a text area using JavaScript

©-Copyright By Duminda Chamara
JavaScript Validation  

Sunday, November 15, 2009

How to upload files in PHP


How to upload files in PHP?

Following example shows you how to upload files using php.

   When you are working with web applications, you may want to upload files to your web server. In php you can upload files very easily. But there are some configuration settings you have to check before you upload a file. Remember that you have to set the form attribute "enctype" to multipart/form-data in your html file. It is a good practice that use separate folder for keep uploaded file in your web server. Also you can create sub folders for keep images, csv files, audio file, etc. Before you upload file check that folder exist in the server. Also make sure that the folder permission is 0777.


   Remember that what are the file types that allow user to upload. Never allow users to upload files containing scripts such as file with .php, .asp, .aspx, .js, etc. extensions. If a user upload such a file it will be a big security risk to your web site. So make sure what are the file types allow to upload. First you have to filter files by extension to avoid this security risk. Also you have to check the files that already exists in the server with the same name. Otherwise previous file will be overwrite from the new one.



Demo- File uploading using PHP.

Configuration settings associated with file upload in PHP

There are some configuration settings in the php.ini file associated with file uploading.

» file_uploads (On/off) Whether to allow HTTP file uploads.
» upload_tmp_dir (C:\temp) Temporary directory for uploaded files.
» upload_max_filesize (2M) Maximum allowed size for uploaded files.
» post_max_size (8M) Maximum size of POST data that PHP will accept. If you want to upload large files you have to set post_max_size larger value than upload_max_filesize value.
» memory_limit (128M) Maximum amount of memory that script can consume.
» max_execution_time (30) Maximum execution time for a script, in seconds. When you need to upload large files you have to set this value to a higher value.
» max_input_time (60) Maximum amount of time each script may spend parsing request data.


$_FILES['my_file']['x'] is an associative array in php. It contains details of the uploaded file such as file name, file size and file type.
First file is uploaded to the temporary directory in the server machine as a temporary file. such as "C:\temp


PHP move_uploaded_file() uploaded function copied the uploaded temporary file to the save location. Temporary file is deleted after the upload.

» $_FILES["file"]["name"] Name of the uploaded file.
$_FILES["file"]["type"] Content type of the uploaded file.
$_FILES["file"]["size"] Size in bytes of the uploaded file.
$_FILES["file"]["tmp_name"] Name of the temporary copy of the file stored on the server.
$_FILES["file"]["error"] Error code regarding the file upload.
Try It!


Bookmark and Share









1. Example code for upload files using PHP

HTML Code
<html>

<head>

<title>File Upload in PHP </title>

</head>

<body>
<form action="upload.php" method="post" enctype="multipart/form-data" name="file_upload_form" id="file_upload_form">

<table border="0">

<tr>

<td width="94">Select File </td>

<td width="96"><input type="file" id="my_file" name="my_file" /></td>

</tr>

<tr>

<td>&nbsp;</td>

<td>

<input name="btn_upload_file" type="submit" id="btn_upload_file" value="Upload" />

</td>

</tr>
</table>
</form>

</body>

</html>
copy above code into a notepad and save it as upload.html and copy following code into another notepad and save it as upload.php
PHP code
<?php

if($_FILES['my_file']['error']==0){

$file_name = $_FILES['my_file']['name'];

$file_type = $_FILES['my_file']['type'];

$file_size = $_FILES['my_file']['size']/1024;



$temp_path = $_FILES['my_file']['tmp_name'];

$file_save_path="uploaded_files/".$file_name;



$uploaded = move_uploaded_file($temp_path,$file_save_path);



if($uploaded==true){

print("The file ".$file_name." has been uploaded successfully");

print("<br/> File Type : ".$file_type);

print("<br/> File Size : ".$file_size. "Kb");

}else{



}

}else{

print("Error while uploading the file ".$_FILES['my_file']['error']);

}

?>







 »   How to create random validation image in PHP
 »   How to get extension of a file using PHP
 »   How to upload and encrypt file in PHP
 »   How to upload files in PHP
 »   How to create arrays in PHP
 »   How to create thumbnail images in PHP
 »   How to connect MySQL Database in PHP




©-Copyright By Duminda Chamara  
JavaScript Validation  

How to create arrays in PHP

How to create arrays in PHP?

This article explains you how to define numeric and indexed arrays in PHP
Create numeric, associative and multidimensional arrays in php

What is an array in php?

An Array is a collection of data values. It can also define as a collection of key/value pairs. An array can store multiple values in as a single variable. because array store values under a single variable name. Each array element has index which is used to access the array element. An array can also store diffrent type of data values. That means you can store integer and string values in the same array. PHP has lot of array functions to deal with arrays. You can store integers, strings, floats or objects in arrays. Arrays are very important in any programming language. You can get complete idea of arrays by reading this tutorial.


How to define an array in PHP?

$numbers = array(1,2,3,4,5,6,7,8,9,0);

This will create an array of 10 elements. array is the pHP keyword that use to define a array. Not like other programming languages array size is not a fixed value. You can expand it at any time. That means you can store any value in the array you create. PHP will ready to adjust the size of the array.

Why arrays are important?

  • Store similar data in a structured manner.
  • Easy to access and change values.
  • You can define any number of values (No need to define multiple variables).
  • Save time and resources.
  • To store temporary data.

In PHP there are two types of arrays.

  1. Numeric/Indexed Arrays
  2. Associative Arrays

Numeric Arrays

An indexed or a numeric array stores its all elements using numerical indexes. Normally indexed array begins with 0 index. When adding elements to the array index will be automatically increased by one. So always maximum index may be less than one to the size of the array. Following example shows you how to declare numeric arrays in pHP

e.g. $programming_languages = array('PHP','Perl','C#');

Also you can define indexed/numeric arrays as follows.

$programming_languages[0]='PHP';
$programming_languages[1]='Perl';
$programming_languages[2]='C#';

Actually you don't need to specify the index, it will be automatically created. So you can also define it as bellow.

$programming_languages[]='PHP';
$programming_languages[]='Perl';
$programming_languages[]='C#';

Above array has three elements. The value 'PHP' has the index of 0 while 'C#' has index of 2. You can add new elements to this array. Then index will be increased one by one. That means the next element index will be 3. You can use that integer index to access array index as follows

echo $programming_languages[2];//This will be print 'C#'
or
echo $programming_languages{2}; //You can also use curly brackets

If you access an element which is not exists in the numeric array you will get an error message like Notice: Undefined offset: 4 in D:\Projects\array.php on line 7.

Associative Arrays

Associative arrays have keys and values. It is similar to two-column table. In associative arrays, key is use to access the its value. Every key in an associative array unique to that array. That means you can't have more than one value with the same key. Associative array is human readable than the indexed arrays. Because you can define a key for the specific element. You can use single or double quotes to define the array key. Following example explains you how to declare associative arrays in pHP

Method 1:
$user_info
= array('name'=>'Nimal','age'=>20,'gender'=>'Male','status'=>'single');

Method 2:
$user_info['name']='Nimal';
$user_info['age']='20';
$user_info['gender']='Male';
$user_info['status']='Single';

Above array has four key pair values. That means array has 4 elements. Each element has a specific key. We use that key to access array element in associative arrays. You can't duplicate the array key. If there a duplicate key, the last element will be used.

echo $user_info['name'];//This will print Nimal
or
echo $user_info{'name'};

If you access an element which is not exists in the associative array you will get an error message like Notice: Undefined index: country in D:\Projects\array.php on line 11.

Multidimensional Arrays

Multidimensional arrays are arrays of arrays. That means one element of the array contains another array. Like wise you can define very complex arrays in pHP Suppose you have to store marks of the students according to their subjects in a class room using an array, You can use a multidimensional array to perform the task. See bellow example.

Syntax:
$marks=array(
'nimal'=>array('English'=>67,'Science'=>80,'Maths'=>70),
'sanka'=>array('English'=>74,'Science'=>56,'Maths'=>60),
'dinesh'=>array('English'=>46,'Science'=>65,'Maths'=>52)
);

echo $marks['sanka']['English'];//This will print Sanka's marks for English

You can use array_keys() method to get all keys of an array. This will returns an array of keys.

print_r(array_keys($marks));
//This will output Array ( [0] => nimal [1] => sanka [2] => dinesh )

Note: you can use student number and subject number instead of using student name and subject name.

1. How to loop/iterate through an array in pHP?

if there are large number of elements in an array, It is not practical to access elements by manually. So you have to use loops for it. You can use foreach and for loops for access array elements. I think foreach loop is the most convenient method to access array elements. because you don't need to know the size of the array. In this tutorial you can learn iterate through arrays.


<?pHP

//Using foreach loop

$days
= array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
foreach($days as $day){
echo $day.'<br/>';
}

//Using for loop

$programmingLanguages = array('PHP','Python','Perl','Java','C#','VB.Net','C++');

for($x=0;$x<count($programmingLanguages);$x++){
echo $programmingLanguages[$x].'<br/>';
}

//Also you can print all array elements using print_r() method. This is useful to determine array structure.

print_r($countries);

//This will out put Array ( [0] => SriLanka [1] => India [2] => America [3] => UK [4] => Japan [5] => China )
? >

2. How to get the size of an array using pHP?

Sometimes you may need to get how many elements exists in the array or the size of the array. You can use pHP in-built methods to find the size of a any array. See bellow examples. Also you can count all elements in a multidimensional array using count() function.


<?pHP

$countries = array('SriLanka','India','America','UK','Japan','China');

echo count($countries); //using count() method
echo '<br/>';
echo sizeof($countries);// using sizeof() method

//Get multidimensional array size

$exchange_rates=array(
'USD'=>array('buying'=>125.00,'selling'=>129.00),
'EUR'=>array('buying'=>165.42,'selling'=>172.81),
'GBP'=>array('buying'=>197.33,'selling'=>205.11)
);

echo count($exchange_rates,true);// this will out put 9
//or
echo count($exchange_rates,COUNT_RECURSIVE);

echo count($exchange_rates,COUNT_NORMAL);// this will out put 3

?>

Tuesday, November 10, 2009

Decimal Number Validation in javascript?

How to validate decimal number using JavaScript?


You can validate decimal number, floating point number using this javascript. If input number is not in the correct format it shows an error message.


Here is the javascript and the html code. Try to validate floating point number using this piece of code


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.table_text{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}
</style>
<script type="text/javascript">
function decimal_check() {
var str=document.forms["decimal_form"].txtDecimalValue.value; 
if(str!=""){
var regDeci=/^[-+]?\d+(\.\d+)?$/;
if(regDeci.test(str)==true){
alert(str+" Is Valid decimal number");
return true;
}else{
alert("Please enter valid number");
return false;
}
}else{
alert("Please enter valid number");
return false;
}
}
</script>
</head>


<body>
<form id="decimal_form" name="decimal_form" method="post" action="" onsubmit="return decimal_check();">
  <table width="200" border="0" class="table_text">
    <tr>
      <td>Decimal Value </td>
      <td><label>
        <input name="txtDecimalValue" type="text" id="txtDecimalValue" />
      </label></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><label>
        <input name="btn_submit" type="submit" id="btn_submit" value="Submit" />
      </label></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>

Tuesday, November 3, 2009

Email Address Validation in Javascript

How to validate an email address using JavaScript?

Following example shows you how to validate an email address in javascript as a client side validation.
We need to validate email address very often. When you register in a web site it prompt your email address. An email address has a predefined format with it. If you entered a email address that not match the pattern, the web application shows you a message that please enter a valid email address. In most cases they use javascript validation as primary validation in forms. You can use Regular Expression to validate the email address. The pattern check the your input is matched email address or not. If it is not a valid email address It indicates that your input is incorrect and re-enter it. E-mail address have two parts (someone@example.com). The part before the @ sign is the local-part of the address, often the username of the recipient (someone), and the part after the @ sign is the domain which is a hostname to which the e-mail message will be sent. every valid email address must contain username, @ sign and domain name.


Demo- How to validate an email address using JavaScript.
Email address validation
1.Enter valid email address. view code
Try it!
Bookmark and Share

1. Example code for validate an email address using JavaScript.

JavaScript Code
<script type="text/javascript" language="javascript"> <!-- function validateEmailAddress(){ var emailAddress = document.getElementById("emailAddress").value; var regExEmail = /^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/; if(emailAddress==''){ alert("Please enter a valid email address"); document.getElementById("emailAddress").focus(); return false; }else{ if(!regExEmail.test(emailAddress)){ alert("Please enter a valid email address"); document.getElementById("emailAddress").focus(); return false; } } alert("OK\nYour email address is in correct format"); return true; } --> </script>
Html Code
<html> <head> <title>How to validate email address in JavaScript </title> </head> <body> <table border="0"> <tr> <td valign="top"> 1.Enter valid email address. </td> <td align="left"> <input name="emailAddress" type="text" id="emailAddress" size="40" /> </td> <td align="left">&nbsp;</td> </tr> <tr> <td align="right">&nbsp;</td> <td align="left" > <input name="btnEmailAddressValidator" type="submit" id="btnEmailAddressValidator" value="Validate" onclick="javascript:validateEmailAddress();" /> </td> <td align="left">&nbsp;</td> </tr> </table> </body> </html>
» How to get screen resolution in JavaScript
» How to limit characters in textarea using JavaScript
» How to validate decimal number in JavaScript
» How to validate an email address in JavaScript
» How to validate date using JavaScript
» JavaScript String functions
» How to validate multiple select list box in JavaScript
» How to generate random numbers in JavaScript
» How to validate multiple check box in JavaScript
» How to validate user login in JavaScript
» How to validate drop down list in JavaScript
» How to validate radio button group in JavaScript
» How to create JavaScript alerts
» How to create popup windows in JavaScript
» How to count words in a text area using JavaScript
©-Copyright By Duminda Chamara JavaScript Validation