欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Javascript 動(dòng)態(tài)改變imput type屬性

 更新時(shí)間:2016年11月01日 11:40:50   投稿:lqh  
這篇文章主要介紹了Javascript 動(dòng)態(tài)改變imput type屬性的相關(guān)資料,并附簡(jiǎn)單實(shí)例代碼,需要的朋友可以參考下

Javascript 動(dòng)態(tài)改變imput type屬性:

代碼實(shí)現(xiàn):

<script type="text/javascript">
  function shoppw(thebox){
    var ps = document.getElementById('ps');
    var pass = document.getElementById('pass');
    ps.removeChild(pass);
    var psImput = document.createElement("INPUT");
    
    if(pass.type == 'password'){
      psImput.type = "text";
    } else {
      psImput.type = 'password';
    }
    psImput.id = 'pass';
    psImput.name = "password";
    psImput.maxlength="15";
    ps.appendChild(psImput);
  }
</script>

HTML代碼:

<td class="label"> * <label for="password" accesskey="">登錄密碼:</label></td>
  <td ><div id="ps"><input type="text" name="password" maxlength="15" id="pass" /></div>
   <input name="checkbox2" type="checkbox" value="true" checked="checked" id="show" onclick="shoppw(this)" />
   <label for="show" accesskey="">顯示</label></td>

 可以運(yùn)行時(shí)動(dòng)態(tài)改變imput元素的type屬性值

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論