密码框和文本框切换

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>密码框和文本框切换</title> <script type="text/javascript" src="jQuery.min.js"></script> <script type="text/javascript" >$(document).ready(function(){ $("#c").val('www');});function pwd(){ ChangeInputToPwd("AAA","","我是密码","password");}function txt(){ ChangeInputToPwd("AAA","","我是文本","text");} function ChangeInputToPwd(cardCode,cardFacecode,carCodeValue,typ) { $("#"+cardCode).after("<input type='"+typ+"' class='input' name='" + cardCode + "' id='" + cardCode + "' style='float:left' value='" + carCodeValue + "'/>").remove(); }</script></head><body> <input type="text" id="AAA" name="AAA"/> <input type="button" value="pwd" onclick="pwd()"> <input type="button" value="txt" onclick="txt()"></body> </html>