View Single Post
  #1 (permalink)  
Old 06-25-09, 02:08 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
change input type

I wrote a little piece of javascript that should change the appearance of an input field:

Code:
function alias_focus2()
{
	if(document.getElementById('sPassword').value == 'password')
	{
		document.getElementById('sWachtwoord').style.color = 'black';		
		document.getElementById('sWachtwoord').value = '';
		document.getElementById('sWachtwoord').type = 'password';
		
	}	
}

function alias_blur2()
{
	if(document.getElementById('sPassword').value == '')
	{
		document.getElementById('sWachtwoord').style.color = 'grey';		
		document.getElementById('sWachtwoord').value = 'password';
		document.getElementById('sWachtwoord').type = 'text';
	}	
}
and this is the HTML for that:

HTML Code:
<input name="sPassword" id="sPassword" type="text" class="zkn" value="password" onfocus="alias_focus2();"  onblur="alias_blur2();" style="color: grey; font-style:italic;" />
on FF and Safari it works.. but on IE it's not working well...
Where did I go wrong?

_j
Reply With Quote