<script language=javascript>
function check(){
alert(document.form1.name1.type);
document.all.div1.innerHTML = "<input name='name1' type='password' />";
}
</script><form method="post" action="" name="form1">
<div id="div1"><input name="name1" type="text" /></div>
<input type="button" value="确定" onClick="javascript:check()" />

解决方案 »

  1.   

    谢谢,但是在<input name='name1' type='password' />;中的值为<input name="name1" type="text" />中输入的值怎么办呢~?就是将输入框中的值变为****,应该怎么办呢?~
      

  2.   

    <script language=javascript>
    function check(){
    alert(document.form1.name1.type);
    var password = document.form1.name1.value;
    document.all.div1.innerHTML = "<input name='name1' type='password'/>";
    document.form1.name1.value = password
    }
    </script>