Sunday, December 30, 2012

PHP Random password generator

How to generate random password using PHP?

The bellow example shows you how to create random passwords in PHP
When you are talking about internet you can't forget security. Basically internet security depends on passwords. Why do you need passwords? Simply because protect your personal data from others. Passwords help you to keep your data secure. Without knowing the password anyone can't read or access your data. When we talking about passwords you have to consider the strength of the password.

Strong password should be,

  1. At least eight characters long.
  2. Very good combination of letters, numbers, and special characters.
  3. Don't use dictionary words.
  4. Don't use your phone number,reverse order of your name,nick name,NIC number,Passport number, or mobile number.
  5. A good combination of simple and capital letters.
  6. Don't use characters or numbers only.
  7. Memorized easily without save it to a other media.
  8. Change your password periodically.

Don't use dictionary words or names as your password. Because it cause to a dictionary attack. Also it is important to keep separate password for your other e-mail or computer accounts.


When you make a password, you have to keep above guidelines in your mind. I f you use a strong password, it is difficult to break the password using automated computer programs. (robot programs) Working with web applications you may be always need to generate random passwords in PHP. Suppose you have a user registration form. After a user registration you have to assign a random password to his account and e-mail login details. So definitely you need to generate random passwords for this case. Following examples describe you how to generate multiple passwords using PHP.

View Live Demo - PHP Random Password Generator

1. How to create random passwords in PHP using numbers?

This example describe you to generate random password with numbers in PHP. Generated password contains integers 0 to 9. But be careful using numerical passwords because it can be break using automated computer programs.

Complete source code for populate random password in PHP.

<?php
function
generatePasswordsUsingNumbers($length){
$numbers='0123456789';
$password_characters = str_split($numbers);
$password='';

for($i=0;$i<$length;$i++){
$password.=$password_characters[rand(0,count($password_characters)-1)];
}
return $password;
}
echo generatePasswordsUsingNumbers(8);
?>

2. How to create random passwords in PHP using alphabetic characters?

Sometimes you may need to create passwords using alphabetic characters. Bellow function explains make random password in php. Populated password contains a random set of simple and capital letters. You can change the length of the password.

Complete PHP source code for generate password with letters.

<?php
function
generatePasswordsUsingCharacters($passwordLength){
$letters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$password_characters = str_split($letters);
$password='';

for($i=0;$i<$passwordLength;$i++){
$password.=$password_characters[rand(0,count($password_characters)-1)];
}
return $password;
}
echo generatePasswordsUsingCharacters(8);
?>

3. How to create random passwords in PHP using alphabetic characters and numeric characters?

When you need php random passwords with a combination of letters and numbers, use bellow function to create passwords. You can make strong passwords using this method. You can pass the parameter "password length" to change the length of the created password. Use higher value to make it strong.

Copy and paste bellow code populate strong password in PHP

<?php
function
generatePasswordsUsingCharactersAndNumbers($passwordLength){
$characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$password_characters = str_split($characters);
$password='';

for($i=0;$i<$passwordLength;$i++){
$password.=$password_characters[rand(0,count($password_characters)-1)];
}
return $password;
}
echo generatePasswordsUsingCharactersAndNumbers(8);
?>

4. PHP class for generate multiple random passwords

This is a special php class that use to generate random passwords. You can generate any kind of passwords using this. It can create various types of passwords including numbers,characters, and special characters. Also you can manually set the special characters. You can generate unbreakable php passwords using this class. Please note before you save to password to the database, convert it to a hash value using one way encryption function. Do not save password directly.

Example code for create multiple random password list using PHP.

<?php
/*
Copyright By http://www.latestcode.net
*/

class PHP_Password_Generator{
public $password_length;
public $password;
private $numbers;
private $alphabetic_chars;
private $special_chars;

private $password_type;

public function __construct($type){
$this->password_type = $type;
$this->numbers='0123456789';
$this->alphabetic_chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$this->special_chars='@#$%&!';
}
/*
Generate Password
*/

public function generate_password($length=8){
$this->password_length = ($length<1?8:$length);
$this->password='';
switch($this->password_type){
case 1:{//Numbers Only
$password_characters = $this->numbers;
}break;
case 2:{//Alphabetic CHaracters Only
$password_characters = $this->alphabetic_chars;
}break;
case 3:{//Numbers And Letters Only
$password_characters = $this->numbers.$this->alphabetic_chars;
}break;
case 4:{//Numbers,Letters, and Special Characters
$password_characters = $this->numbers.$this->alphabetic_chars.$this->special_chars;
}break;
default:{//Letters
$password_characters = $this->alphabetic_chars;
}break;
}
$password_characters = str_split($password_characters);
shuffle($password_characters);

for($i=0;$i<$this->password_length;$i++){
$this->password.=$password_characters[rand(0,count($password_characters)-1)];
}
return $this->password;
}
/*
Add custom special characters to the password
*/

public function set_special_characters($special_chars){
$this->special_chars = $special_chars;
}
}

//Example 1:
$pwd = new PHP_Password_Generator(4);//Generate password with numbers,letters, and special characters
echo $pwd->generate_password(10);//specify password length

//Example 2:
$pwd = new PHP_Password_Generator(4);
$pwd->set_special_characters('@#$%^&*');//Set custom special characters
echo $pwd->generate_password(10);

//Example 3:
$pwd = new PHP_Password_Generator(1);//Password will contain numbers
echo $pwd->generate_password(10);

//Example 4:
$pwd = new PHP_Password_Generator(4);//Make list of passwords
for($x=0;$x<5;$x++){
echo $pwd->generate_password(10).'<br/>';
}
?>

Thursday, December 27, 2012

change text case in JavaScript


Convert string to lower case/upper case using  JavaScript?


The following example shows you how to use toLowerCase() and toUpperCase() method in JavaScript

You may need to change the text to upper case or lower case in JavaScript There are two built-in string functions to change the letter case in JavaScript. toLowerCase() is changes the text to small letters (Simple Letters) and toUpperCase() changes the text to big letters (Capital Letters) The syntax of the toUpperCase() and toLowerCase() as follows

string lower=text.toLowerCase();

Usage:
var myString="You Can easily Change given Text to Lower Case in JavaScript";
//make small letters using JavaScript
alert(myString.toLowerCase());

string upper=text.toUpperCase();

Usage:
var myString="It is very easy To change given text case to Upper in JavaScript";
//make big letters using JavaScript
alert(myString.toUpperCase());
toUpperCase() and toLowerCase() functions returns the all input text to upper case and lower case respectively. Using above tow methods, you can easily change a whole paragraph to simple letters or capital letters. When doing string formatting in JavaScript these two methods are very useful. You can use these methods to build programs that convert string capitalization in sentence case or title case.

1. How to convert lowercase/ simple letters to upper case using JavaScript?


Your Text that need to change case :
Output :
Also Convert text in the Textarea :
make capital letters
This example shows you how to convert text in a text area to uppercase. Some times you may need to convert user input in to capital letters, in such case you can use this example to to make capital letters in JavaScript.
Complete source code for change all letters of a given string to capital.

<!DOCTYPE HTML>
<html>
<head>
<title>Convert string to capital letters</title>
<style type="text/css">
.javascript_change_case{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_change_case .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_change_case input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .message{color:#F00;}
.javascript_change_case .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_change_case .pwd{font-size:16px;color:#FF0000;}
.javascript_change_case .link{color:#FF0000;}
</style>
<script type="text/javascript">
function makeCapitalLetters(){
var text = document.getElementById("paragraph1").value;
var capital = text.toUpperCase();
document.getElementById("upper_case_output").innerHTML=capital;
if(document.getElementById("checkSource1").checked){
document.getElementById("paragraph1").value=capital;
}
alert(capital);
}
</script>
</head>
<form id="javascript_change_case1" name="javascript_change_case1" action="#" method="post">
<table border="0" class="javascript_change_case">
<tr>
<td align="right">Your Text that need to change case</td>
<td>:</td>
<td><textarea name="paragraph1" cols="40" rows="5" id="paragraph1">This is a sample paragraph</textarea></td>
</tr>
<tr>
<td align="right">Output</td>
<td>:</td>
<td><span id="upper_case_output" class="link"></span></td>
</tr>
<tr>
<td align="right">Also Convert text in the Textarea </td>
<td>:</td>
<td><input type="checkbox" name="checkSource1" id="checkSource1"></td>
</tr>
<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:makeCapitalLetters();">make capital letters</a></td>
<td>&nbsp;</td>
<td><input name="btnToUpper" type="button" class="button" id="btnToUpper" value="Conver to Upper Case" onClick="javascript:makeCapitalLetters();"><span class="pwd" id="number_of_words"></span></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

2. How to convert uppercase/capital letters to lower case using JavaScript?


Your Text that need to change case :
Output :
Also Convert text in the Textarea :
make simple letters
Sometimes you may need to change all text in a textarea in to simple letters before you save it to the database in your web application. You can use this client side script to convert text to simple letters. This may useful when you save user e-mail address to the database or save a web URL.
Complete JavaScript source code for conver text to simple letters in a textarea.

<!DOCTYPE HTML>
<html>
<head>
<title>Conver text to lower case</title>
<style type="text/css">
.javascript_change_case{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_change_case .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_change_case input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .message{color:#F00;}
.javascript_change_case .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_change_case .pwd{font-size:16px;color:#FF0000;}
.javascript_change_case .link{color:#FF0000;}
</style>
<script type="text/javascript">
function makeSimpleLetters(){
var text = document.getElementById("paragraph2").value;
var simple = text.toLowerCase();
document.getElementById("lower_case_output").innerHTML=simple;
if(document.getElementById("checkSource2").checked){
document.getElementById("paragraph2").value=simple;
}
alert(simple);
}
</script>
</head>
<blockquote>
<form id="javascript_change_case2" name="javascript_change_case2" action="#" method="post">
<table border="0" class="javascript_change_case">
<tr>
<td align="right">Your Text that need to change case</td>
<td>:</td>
<td><textarea name="paragraph2" cols="40" rows="5" id="paragraph2">This is a sample paragraph</textarea></td>
</tr>
<tr>
<td align="right">Output</td>
<td>:</td>
<td><span id="lower_case_output" class="link"></span></td>
</tr>
<tr>
<td align="right">Also Convert text in the Textarea </td>
<td>:</td>
<td><input type="checkbox" name="checkSource2" id="checkSource2"></td>
</tr>
<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:makeSimpleLetters();">make simple letters</a></td>
<td>&nbsp;</td>
<td><input name="btnToUpper" type="button" class="button" id="btnToUpper" value="Conver to Lower Case" onClick="javascript:makeSimpleLetters();"><span class="pwd" id="number_of_words"></span></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</blockquote>
</body>
</html>

3. How to capitalize first letter of each word in a sentence using JavaScript?


Text to capitalize each word :
Output :
Make Title Case
When you are doing programming you may need to convert a string in to title case. You can use two methods to make title case using JavaScript. You can use regular expression or write a basic program to convert a paragraph in to title case. In this I have use a little javascript code to make each word capital in a sentence. This script may useful to format names, addresses etc.
Copy and paste following source code for make title capitalization in a sentence

<!DOCTYPE HTML>
<html>
<head>
<title>Title case capitalization example</title>
<style type="text/css">
.javascript_change_case{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_change_case .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_change_case input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .message{color:#F00;}
.javascript_change_case .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_change_case .pwd{font-size:16px;color:#FF0000;}
.javascript_change_case .link{color:#FF0000;}
</style>
<script type="text/javascript">
function capitalize(e) {
var t = '"@.,”/!?%^&*=+<>|`~-_(){}[]#;:“0123456789';
var n = "";
var r = 0;
e: for (var i = 0; i < e.length; i++) {
for (var s = 0; s < t.length; s++) {
var o = e.charCodeAt(i);
if (o >= 65 && o <= 90 || o >= 97 && o <= 122) {
r = i;
break e;
}
}
}
if (r == 0) {
n = e.charAt(0).toUpperCase() + e.substring(1, e.length);
} else {
n = e.substring(0, r) + e.charAt(r).toUpperCase() + e.substring(r + 1, e.length - r + 1);
}
return n;
}
function makeTitleCase() {
var e = document.getElementById("paragraph3").value;
var t = "";
var n = "";
for (var r = 0; r < e.length; r++) {
var i = e.charCodeAt(r);
if (i == 32 || i == 10) {
if (n != "") {
t += capitalize(n) + (i == 10 ? "<br/><br/>" : " ");
n = "";
continue;
}
n = "";
} else {
if (n == "") {
n += e.charAt(r).toUpperCase();
} else {
n += e.charAt(r).toLowerCase();
}
}
}
t += capitalize(n) + " ";
document.getElementById("title_case_output").innerHTML = t;
}
</script>
</head>
<blockquote>
<form id="javascript_change_case3" name="javascript_change_case3" action="#" method="post">
<table border="0" class="javascript_change_case">
<tr>
<td align="right">Text to capitalize each word</td>
<td>:</td>
<td><textarea name="paragraph3" cols="40" rows="5" id="paragraph3">This is a sample paragraph</textarea></td>
</tr>
<tr>
<td align="right">Output</td>
<td>:</td>
<td><span id="title_case_output" class="link"></span></td>
</tr>

<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:makeTitleCase();">Make Title Case</a></td>
<td>&nbsp;</td>
<td><input name="btnToTitleCase" type="button" class="button" id="btnToTitleCase" value="Conver to Title Case" onClick="javascript:makeTitleCase();"><span class="pwd" id="number_of_words"></span></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</blockquote>
</body>
</html>

4. How to capitalize every word in a sentence using regular expression?


Text to Title Case :
Output :
Build Title Case
You can use regular expression for convert every word in a string. It reduce your code in to one or two lines. Easy to use.
Regular expression code explanation: /\w\S*/g
\w means find all Alphanumeric characters plus "_" ([A-Za-z0-9_])
\S means Non-white space characters
g parameter indicates, Perform a global replacement
Copy and paste bellow code code to convert text to title case using regular expression.

<!DOCTYPE HTML>
<html>
<head>
<title>Change case in javascript</title>
<style type="text/css">
.javascript_change_case{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_change_case .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_change_case input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_change_case .message{color:#F00;}
.javascript_change_case .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_change_case .pwd{font-size:16px;color:#FF0000;}
.javascript_change_case .link{color:#FF0000;}
</style>
<script type="text/javascript">
function changeTitleCase(){
var userInput=document.getElementById("paragraph4");
var titleCase= userInput.value.replace(/\w\S*/g,function(text){
return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();
});
document.getElementById("reg_title_case_output").innerHTML=titleCase;
}
</script>
</head>
<blockquote>
<form id="javascript_change_case4" name="javascript_change_case4" action="#" method="post">
<table border="0" class="javascript_change_case">
<tr>
<td align="right">Text to Title Case</td>
<td>:</td>
<td><textarea name="paragraph4" cols="40" rows="5" id="paragraph4">You can use regular expression to make title case text in javascript</textarea></td>
</tr>
<tr>
<td align="right">Output</td>
<td>:</td>
<td><span id="reg_title_case_output" class="link"></span></td>
</tr>

<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:changeTitleCase();">Build Title Case</a></td>
<td>&nbsp;</td>
<td><input name="btnToTitleCase" type="button" class="button" id="btnToTitleCase" value="Get Title Case Text" onClick="javascript:changeTitleCase();"><span class="pwd" id="number_of_words"></span></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</blockquote>
</body>
</html>

Thursday, December 20, 2012

JavaScript charAt() method

Usage of JavaScript charAt() method with live examples

The following example shows you how to use charAt() method in JavaScript
charAt() is a function that use to deal with strings. You can get a character in a specified string using this method. suppose that you have to get the character in a specific index of a given string; You can easily get that using charAt() method. Hear is the Syntax of the method.

char x=string.charAt(index);

Usage:
var myString="java script is easy to learn";
//you want to get 7th character.
alert("Index 6 contains the character "+ myString(6));

Remember that indexing begins with zero. So the index of the 1st character is zero. Therefore always maximum index is less than one of the length of the string. That means if you want to get the last character of a string you need to pass (string length-1) as the index. Following simple examples explains you how to use charAt() method in JavaScript programming.

1. How to get the first character of a given string using JavaScript?

Your String  
First Character of the string is    
Find It!  

Type any word or sentence in the provided text box. Then click on the "Find 1st Char" button. You will get the first character as the function output. If your entered string contains a space at the beginning, space will be shown as first character.

Complete source code for get the first character of a string.
<!DOCTYPE HTML>
<html>
<head>
<title>*avaScript charAt() Method Examples</title>
<style type="text/css">
.javascript_charAt{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin-top:10%;width:auto;}
.javascript_charAt .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_charAt input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .message{color:#F00;}
.javascript_charAt .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_charAt .pwd{font-size:16px;color:#FF0000;}
.javascript_charAt .link{color:#FF0000;}
</style>
<script type="text/JavaScript">
function find_first_character(){
var str=document.getElementById("txtString1");
if(str.value.replace(/\s+$/,"")==""){
alert("Please enter valid string");
str.select();
str.focus();
return false;
}else{
var first_character= str.value.charAt(0);
document.getElementById("selected_char").innerHTML=first_character;
alert("First character is "+first_character);
}
}
</script>
</head>
<body>
<form id="javascript_charat1" name="javascript_charat1" action="#" method="post">
<table border="0" class="javascript_charAt">
<tr>
<td align="right">Your String</td>
<td>&nbsp;</td>
<td><input name="txtString1" type="text" id="txtString1" value="This is a sample string" maxlength="100"></td>
</tr>
<tr>
<td align="right">First Character of the string</td>
<td>&nbsp;</td>
<td><span id="selected_char" class="pwd" style="height:auto;">&nbsp;</span></td>
</tr>
<tr>
<td><a href="JavaScript:void(0);" rel="nofollow" onClick="JavaScript:find_first_character();">Find It!</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Find 1st Char" onClick="JavaScript:find_first_character();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

2. How find the character at given index of a string using JavaScript?

Your String  
Character Index  
Character at the given index    
Get Character!  

Some times you may need to get the character in a specific string position. Using above example you can determine the character in given string index. Think that you are developing a JavaScript application to find the words which has the same character in a specific index, then you can use this sample script to do the work.

Complete JavaScript source code for find a character at given index.
<!DOCTYPE HTML>
<html>
<head>
<title>*avaScript charAt() Method Examples</title>
<style type="text/css">
.javascript_charAt{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin-top:10%;width:auto;}
.javascript_charAt .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_charAt input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .message{color:#F00;}
.javascript_charAt .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_charAt .pwd{font-size:16px;color:#FF0000;}
.javascript_charAt .link{color:#FF0000;}
</style>
<script type="text/JavaScript">
function display_error_message(message,element){
alert(message);
element.select();
element .focus();
return false;
}
function find_given_index(){
var str=document.getElementById("txtString2");
var yourIndex = document.getElementById("character_index");

if(yourIndex.value.replace(/\s+$/,"")=="" || isNaN(yourIndex.value)){
display_error_message("Please enter a valid index",yourIndex);
}else{
if(parseInt(yourIndex.value)<0){
display_error_message("Index can't be less than 0",yourIndex);
}else{
if(str.value.length==0 || (str.value.length-1)<parseInt(yourIndex.value)){
display_error_message("Entered string length is not long enough\nPlease enter a long string",str);
}else{
var selected_character= str.value.charAt(parseInt(yourIndex.value));
document.getElementById("selected_char").innerHTML=selected_character;
alert("Character index at "+yourIndex.value+" is "+selected_character);
return selected_character;
}
}
}
return false;
}
</script>
</head>
<body>
<form id="javascript_charat2" name="javascript_charat2" action="#" method="post">
<table border="0" class="javascript_charAt">
<tr>
<td align="right">Your String</td>
<td>&nbsp;</td>
<td><input name="txtString2" type="text" id="txtString2" value="abcdefghijklmnopqrstuvwxyz" maxlength="100"></td>
</tr>
<tr>
<td align="right">Character Index</td>
<td>&nbsp;</td>
<td><input name="character_index" type="text" id="character_index" value="0" size="5" maxlength="3"></td>
</tr>
<tr>
<td align="right">Character at the given index</td>
<td>&nbsp;</td>
<td><span id="selected_char" class="pwd" style="height:auto;">&nbsp;</span></td>
</tr>
<tr>
<td><a href="JavaScript:void(0);" rel="nofollow" onClick="JavaScript:find_given_index();">Get Character!</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Find Character" onClick="JavaScript:find_given_index();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

3. How to find the all occurrences of a character in given string using JavaScript?

Your String  
Character to find  
Search Results    
Get Character Occurrence  

Suppose that you are developing a JavaScript application for find words in a paragraph with specific characters and the number of times that character appear in the word. So applying this method, you can complete your work.

Copy and paste bellow code to get instance of a character appear in a string in JavaScript
<!DOCTYPE HTML>
<html>
<head>
<title>*avaScript charAt() Method Examples</title>
<style type="text/css">
.javascript_charAt{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_charAt .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_charAt input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .message{color:#F00;}
.javascript_charAt .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_charAt .pwd{font-size:16px;color:#FF0000;}
.javascript_charAt .link{color:#FF0000;}
</style>
<script type="text/JavaScript">
function find_all_occurrence(){
var myString = document.getElementById("txtString2");
var yourCharacter = document.getElementById("yourCharacter");
var number_of_characters=0;

for(var j=0;j<myString.value.length;j++){
if(myString.value.charAt(j)==yourCharacter.value){
number_of_characters++;
}
}
if(number_of_characters>0){
var msg=yourCharacter.value+" found "+number_of_characters+" times";
document.getElementById("search_result").innerHTML=msg;
alert(msg);
return number_of_characters;
}else{
var msg=yourCharacter.value+" is not found in entered string";
document.getElementById("search_result").innerHTML=msg;
alert(msg);
return 0;
}
}
</script>
</head>
<body>
<form id="javascript_charat2" name="javascript_charat2" action="#" method="post">
<table border="0" class="javascript_charAt">
<tr>
<td align="right">Your String</td>
<td>&nbsp;</td>
<td><input name="txtString2" type="text" id="txtString2" value="abcdefghijklmnopqrstuvwxyz" maxlength="100"></td>
</tr>
<tr>
<td align="right">Character to find</td>
<td>&nbsp;</td>
<td><input name="yourCharacter" type="text" id="yourCharacter" value="c" size="5" maxlength="3"></td>
</tr>
<tr>
<td align="right">Search Results</td>
<td>&nbsp;</td>
<td><span id="search_result" class="pwd" style="height:auto;">&nbsp;</span></td>
</tr>
<tr>
<td><a href="JavaScript:void(0);" rel="nofollow" onClick="JavaScript:find_all_occurrence();">Get Character Occurrence</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Get Character Occurrence" onClick="JavaScript:find_all_occurrence();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

4. How to find the first occurrence of a specified character in a string?

Your String  
Character to find  
Index of the 1st occurrence    
Get First Occurrence  
 

Suppose that you need to develop a program to find the first occurrence that a character appears in a given word. What you have to do is loop through to word till you met the character, then break the loop. Likewise you can determine the vowels and consonants in a given word.

Copy and paste bellow code code to get the first occurrence of a character in given word.
<!DOCTYPE HTML>
<html>
<head>
<title>*avaScript charAt() Method Examples</title>
<style type="text/css">
.javascript_charAt{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_charAt .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_charAt input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .message{color:#F00;}
.javascript_charAt .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_charAt .pwd{font-size:16px;color:#FF0000;}
.javascript_charAt .link{color:#FF0000;}
</style>
<script type="text/JavaScript">
function find_first_occurrence(){
var myString = document.getElementById("txtString4");
var char_to_find = document.getElementById("char_to_find");
var first_met='';

for(var j=0;j<myString.value.length;j++){
if(myString.value.charAt(j)==char_to_find.value){
first_met=j;
break;
}
}
if(first_met!=''){
var msg="Index of the first occurrence of of "+char_to_find.value+" is "+first_met;
document.getElementById("search_result2").innerHTML=first_met;
alert(msg);
return first_met;
}else{
var msg=char_to_find.value+" is not found in the string";
document.getElementById("search_result2").innerHTML='Not Found';
alert(msg);
return null;
}
}
</script>
</head>
<body>
<form id="javascript_charat4" name="javascript_charat4" action="#" method="post">
<table border="0" class="javascript_charAt">
<tr>
<td align="right">Your String</td>
<td>&nbsp;</td>
<td><input name="txtString4" type="text" id="txtString4" value="abcdefghijklmnopqrstuvwxyz" maxlength="100"></td>
</tr>
<tr>
<td align="right">Character to find</td>
<td>&nbsp;</td>
<td><input name="char_to_find" type="text" id="char_to_find" value="c" size="5" maxlength="3"></td>
</tr>
<tr>
<td align="right">Index of the 1st occurrence</td>
<td>&nbsp;</td>
<td><span id="search_result2" class="pwd" style="height:auto;">&nbsp;</span></td>
</tr>
<tr>
<td><a href="JavaScript:void(0);" rel="nofollow" onClick="JavaScript:find_first_occurrence();">Get First Occurrence</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Get 1st Occurrence" onClick="JavaScript:find_first_occurrence();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

5. JavaScript program to find the words with specified characters in a paragraph?

Your String  
Count the words which have letter  
Words found  
Get Words  

Above program can find words in a textarea/pragraph that contains a specified character. No matter where the character appears in the word. Type a lengthy paragraph and mension a character that you need to find in words and simply press "Get the Words" Button. You will get the complete list of words and the count of words at the same time.
Bellow code code describes how to calculate words begins with a given character using JavaScript.
<!DOCTYPE HTML>
<html>
<head>
<title>*avaScript charAt() Method Examples</title>
<style type="text/css">
.javascript_charAt{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin:5px;width:auto;}
.javascript_charAt .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_charAt input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_charAt .message{color:#F00;}
.javascript_charAt .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_charAt .pwd{font-size:16px;color:#FF0000;}
.javascript_charAt .link{color:#FF0000;}
</style>
<script type="text/JavaScript">
function count_words_with(){
var myString = document.getElementById("txtString4");
var char_to_find = document.getElementById("char_to_find");
var first_met='';

for(var j=0;j<myString.value.length;j++){
if(myString.value.charAt(j)==char_to_find.value){
first_met=j;
break;
}
}
if(first_met!=''){
var msg="Index of the first occurrence of of "+char_to_find.value+" is "+first_met;
document.getElementById("search_result2").innerHTML=first_met;
alert(msg);
return first_met;
}else{
var msg=char_to_find.value+" is not found in the string";
document.getElementById("search_result2").innerHTML='Not Found';
alert(msg);
return null;
}
}
</script>
</head>
<body>
<form id="javascript_charat4" name="javascript_charat4" action="#" method="post">
<table border="0" class="javascript_charAt">
<tr>
<td align="right">Your String</td>
<td>&nbsp;</td>
<td><input name="txtString4" type="text" id="txtString4" value="abcdefghijklmnopqrstuvwxyz" maxlength="100"></td>
</tr>
<tr>
<td align="right">Character to find</td>
<td>&nbsp;</td>
<td><input name="char_to_find" type="text" id="char_to_find" value="c" size="5" maxlength="3"></td>
</tr>
<tr>
<td align="right">Index of the 1st occurrence</td>
<td>&nbsp;</td>
<td><span id="search_result2" class="pwd" style="height:auto;">&nbsp;</span></td>
</tr>
<tr>
<td><a href="JavaScript:void(0);" rel="nofollow" onClick="JavaScript:count_words_with();">Get First Occurrence</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Get 1st Occurrence" onClick="JavaScript:count_words_with();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

Saturday, December 15, 2012

JavaScript random password generator

How to generate random password using JavaScript?

The following example explains you how to create random passwords in JavaScript
Passwords are very important when you using the Internet. For a moment, think how many passwords that you have to use in a day-today life? When you are log into your computer you have to enter the password, Then sing into Facebook,Gmail,HotMail or any other mail program or social network you have to enter your password. Why we need passwords? because we have to protect our data from other people. Hackers, Malicious programs even your friends try to stole you password. So you have to use strong passwords for your accounts.

A good password should be,

  1. At least 8 characters long.
  2. A good combination of letters, numbers and other symbols.
  3. Avoid dictionary words.
  4. Don't use your nick name,NIC,Passport,Mobile number.
  5. A combination of simple and capital letters.
  6. Don't use numbers or characters only.
  7. Change your password regularly.

If you use dictionary words as your password you may be a victim of a dictionary attack. So always try to use strong passwords. Also remember that don't use same password for all your accounts.


When your are developing web applications that creating user registration forms, you may need to provide random passwords for user login. In such cases you can easily use JavaScript to generate random passwords. following sample programs shows you how create random passwords with different combination of letters, numbers and other characters.

1. How to create random passwords in JavaScript using numbers?

Numbers   Numeric characters 0 to 9
Password Length  
Password    
Generate Password  

In this example, you can generate passwords using numbers 0 to 9. You can decide the generated password length. I have limit the maximum password length to 15. Insert the length of the password that you want to generate and hit "Generate Password" button.

Complete source code for populate random password using numbers.
<!DOCTYPE HTML>
<html>
<head>
<title>Create Random Java script Passwords</title>
<style type="text/css">
.javascript_random_passwords{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin-top:10%;width:auto;}
.javascript_random_passwords .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_random_passwords input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .message{color:#F00;}
.javascript_random_passwords .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_random_passwords .pwd{font-size:16px;color:#FF0000;}
.javascript_random_passwords .link{color:#FF0000;}
</style>
<script type="text/javascript">
function generate_password(){
var password_numbers=Array('1','2','3','4','5','6','7','8','9','0');
var password_length = document.getElementById("txtPasswordLength");
if(isNaN(password_length.value) || parseInt(password_length.value)==0 || (password_length.value.replace(/\s+$/,"")=="")){
alert("Please enter valid password length");
password_length.select();
password_length.focus();
return false;
}
var pwdLen=parseInt(password_length.value);

var password='';
var len=0;
for(var i=0;i<pwdLen;i++){
password+=password_numbers[Math.floor(Math.random()*password_numbers.length)];
}
document.getElementById("password1").innerHTML=password;
}
</script>
</head>
<body>
<form id="generate_random_passwords_1" name="generate_random_passwords_1" action="#" method="post">
<table border="0" class="javascript_random_passwords">
<tr>
<td align="right">Numbers</td>
<td>&nbsp;</td>
<td>1234567890</td>
</tr>
<tr>
<td align="right">Password Length</td>
<td>&nbsp;</td>
<td><input name="txtPasswordLength" type="text" id="txtPasswordLength" value="3" size="5"></td>
</tr>
<tr>
<td align="right">Password</td>
<td>&nbsp;</td>
<td><span id="password1" class="pwd">&nbsp;</span></td>
</tr>
<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:generate_password();">Generate Password</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword1" type="button" class="button" id="btnGeneratePassword1" value="Generate Password" onClick="javascript:generate_password();"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

2. How to create random passwords in javascript using alphabetic characters?

Characters   Lower case and upper case letters from a to z
Password Length  
Password    
Get Password  

If you need to generate random passwords from English alphabetic, you can use this example code to do that. Generated passwords will contain lowercase and uppercase letters from A to Z.

Complete Javascript source code for generate password with letters.
<!DOCTYPE HTML>
<html>
<head>
<title>Create Random Javascript Passwords with characters</title>
<style type="text/css">
.javascript_random_passwords{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin-top:10%;width:auto;}
.javascript_random_passwords .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_random_passwords input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .message{color:#F00;}
.javascript_random_passwords .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_random_passwords .pwd{font-size:16px;color:#FF0000;}
.javascript_random_passwords .link{color:#FF0000;}
</style>
<script type="text/javascript">
function generate_password2(){
var password_characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var password_length = document.getElementById("txtPasswordLength");
if(isNaN(password_length.value) || parseInt(password_length.value)==0 || (password_length.value.replace(/\s+$/,"")=="")){
alert("Please enter valid password length");
password_length.select();
password_length.focus();
return false;
}
var pwdLen=parseInt(password_length.value);
pwdLen=(pwdLen<=15)?pwdLen:15;

var password='';
var len=0;
for(var i=0;i<pwdLen;i++){
password+=password_characters.charAt(Math.floor(Math.random()*password_characters.length))
}
document.getElementById("password2").innerHTML=password;
}
</script>
</head>
<body>
<form id="generate_random_passwords_2" name="generate_random_passwords_2" action="#" method="post">
<table border="0" class="javascript_random_passwords">
<tr>
<td align="right">Characters</td>
<td>&nbsp;</td>
<td>Lower case and upper case letters from a to z</td>
</tr>
<tr>
<td align="right">Password Length</td>
<td>&nbsp;</td>
<td><input name="txtPasswordLength" type="text" id="txtPasswordLength" value="8" size="5"></td>
</tr>
<tr>
<td align="right">Password</td>
<td>&nbsp;</td>
<td><span id="password2" class="pwd">&nbsp;</span></td>
</tr>
<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:generate_password2();">Generate Password</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword1" type="button" class="button" id="btnGeneratePassword1" value="Generate Password" onClick="javascript:generate_password2();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

3. How to create random passwords in javascript using alphabetic characters and numeric characters?

Characters   Lower case and upper case letters from a to z and numbers 0 to 9
Password Length  
Password    
Create Password  

This simple example shows you how to generate a random password including numeric characters and alpha numeric characters. So created password contains a combination of letters and numbers. You can set the minimum password length.

Copy and paste bellow code populate strong password in JavaScript.
<!DOCTYPE HTML>
<html>
<head>
<title>Create Random Javascript Passwords with characters</title>
<style type="text/css">
.javascript_random_passwords{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin-top:10%;width:auto;}
.javascript_random_passwords .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_random_passwords input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .message{color:#F00;}
.javascript_random_passwords .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_random_passwords .pwd{font-size:16px;color:#FF0000;}
.javascript_random_passwords .link{color:#FF0000;}
</style>
<script type="text/javascript">
function generate_password3(){
var password_characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var password_length = document.getElementById("txtPasswordLength");
if(isNaN(password_length.value) || parseInt(password_length.value)==0 || (password_length.value.replace(/\s+$/,"")=="")){
alert("Please enter valid password length");
password_length.select();
password_length.focus();
return false;
}
var pwdLen=parseInt(password_length.value);
pwdLen=(pwdLen<=15)?pwdLen:15;

var password='';
var len=0;
for(var i=0;i<pwdLen;i++){
password+=password_characters.charAt(Math.floor(Math.random()*password_characters.length))
}
document.getElementById("password2").innerHTML=password;
}
</script>
</head>
<body>
<form id="generate_random_passwords_3" name="generate_random_passwords_3" action="#" method="post">
<table border="0" class="javascript_random_passwords">
<tr>
<td align="right">Characters</td>
<td>&nbsp;</td>
<td>Lower case and upper case letters from a to z and numeric characters 0 to 9</td>
</tr>
<tr>
<td align="right">Password Length</td>
<td>&nbsp;</td>
<td><input name="txtPasswordLength" type="text" id="txtPasswordLength" value="8" size="5"></td>
</tr>
<tr>
<td align="right">Password</td>
<td>&nbsp;</td>
<td><span id="password2" class="pwd">&nbsp;</span></td>
</tr>
<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:generate_password3();">Create Password</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Create Password" onClick="javascript:generate_password3();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

4. How to generate list of random passwords using JavaScript?

Characters   Lower case and upper case characters from a to z and numeric characters 0 to 9
Password Length  
Number of passwords  
Passwords    
Populate Passwords  

Suppose that you want to offer a list of randomly generated passwords to to user, this example shows that how to perform the task. User can select his preferred password from the list. here i have limit the password length to 15 characters and number of created passwords to 5. You can customize this as your wish.

Copy and paste bellow code for create a random password list using Javascript.
<!DOCTYPE HTML>
<html>
<head>
<title>Create Random Javascript Passwords with characters</title>
<style type="text/css">
.javascript_random_passwords{border: 1px solid #0080C0;background-color: #f5f5f5;font-family:Tahoma, Geneva, sans-serif;font-size:13px;padding:8px;margin-top:10%;width:auto;}
.javascript_random_passwords .title{font-size:14px;font-weight:bolder;margin-top:10px;}
.javascript_random_passwords input{border: 1px solid #0080C0;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .error_input{border: 1px solid #FF0000;border-radius: 2px 2px 2px 2px;}
.javascript_random_passwords .message{color:#F00;}
.javascript_random_passwords .button{font-family:inherit;border: 1px solid #000099;border-radius: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;}
.javascript_random_passwords .pwd{font-size:16px;color:#FF0000;}
.javascript_random_passwords .link{color:#FF0000;}
</style>
<script type="text/javascript">
function generate_password4(){
var password_characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var password_length = document.getElementById("txtPasswordLength");
var number_of_passwords = document.getElementById("txtNumberOfPasswords");

if(isNaN(password_length.value) || parseInt(password_length.value)==0 || (password_length.value.replace(/\s+$/,"")=="")){
alert("Please enter valid password length");
password_length.select();
password_length.focus();
return false;
}
if(isNaN(number_of_passwords.value) || parseInt(number_of_passwords.value)==0 || (number_of_passwords.value.replace(/\s+$/,"")=="")){
alert("Please enter number of passwords that you need");
number_of_passwords.select();
number_of_passwords.focus();
return false;
}
var pwdLen=parseInt(password_length.value);
pwdLen=(pwdLen<=15)?pwdLen:15;
var NoOfPwd=parseInt(number_of_passwords.value);
NoOfPwd=(NoOfPwd<=5)?NoOfPwd:5;

var passwords='';

for(j=0;j<NoOfPwd;j++){
for(var i=0;i<pwdLen;i++){
passwords+=password_characters.charAt(Math.floor(Math.random()*password_characters.length))
}
passwords+='<br/>';
}
document.getElementById("password2").innerHTML=passwords;
}
</script>
</head>
<body>
<form id="generate_random_passwords_4" name="generate_random_passwords_4" action="#" method="post">
<table border="0" class="javascript_random_passwords">
<tr>
<td align="right">Characters</td>
<td>&nbsp;</td>
<td>Lower case and upper case letters from a to z and numeric characters 0 to 9</td>
</tr>
<tr>
<td align="right">Password Length</td>
<td>&nbsp;</td>
<td><input name="txtPasswordLength" type="text" id="txtPasswordLength" value="8" size="5"></td>
</tr>
<tr>
<td align="right">Number of passwords</td>
<td>&nbsp;</td>
<td><input name="txtNumberOfPasswords" type="text" id="txtNumberOfPasswords" value="8" size="5" maxlength="2"></td>
</tr>
<tr>
<td align="right">Passwords</td>
<td>&nbsp;</td>
<td><span id="password2" class="pwd" style="height:auto;">&nbsp;</span></td>
</tr>
<tr>
<td><a href="javascript:void(0);" rel="nofollow" onClick="javascript:generate_password4();">Create Password</a></td>
<td>&nbsp;</td>
<td><input name="btnGeneratePassword3" type="button" class="button" id="btnGeneratePassword3" value="Create Password" onClick="javascript:generate_password4();"></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>