Thanks everyone for the inputs.
I did something like below and it works:
<html>
<head>
<scrfieldt type="text/javascrfieldt">
var globalvariable;
function onBodyLoad()
{
globalvariable = document.getElementById('
test').cloneNode(true);
}
function UnMask(field){
var NewField=globalvariable.cloneNode(true);
if( field.type == 'password')
{
NewField.type = 'text';
NewField.value = field.value;
field.parentNode.replaceChild(NewField,field);
}
}
function Mask(field){
var NewField=globalvariable.cloneNode(true);
if(NewField.type == 'text')
{
NewField.type='password';
NewField.value = field.value;
field.parentNode.replaceChild(NewField,field);
}
}
</scrfieldt>
</head>
<body onLoad="onBodyLoad()">
<input id="test" type="text" onBlur = "Mask(this);" onFocus = "Unmask(this);" >
<input id="test1" type="text" >
</body>
</html>