zoukankan      html  css  js  c++  java
  • js总结:增加和减少文本框

    <head>
    <script>
    var count = 0;

    function add()
    {
    if(count<3)
    {
    count++;
    var x= document.createElement("input");
    x.setAttribute("type","text");
    x.setAttribute("name","gjdw"+count);
    x.setAttribute("id","gjdw"+count);
    var td = document.getElementById("gjdw0");
    td.appendChild(x);
    }
    }

    function del()
    {
    if(count>=1)
    {
    var td = document.getElementById("gjdw"+count);
    td.parentNode.removeChild(td);
    count--;
    }
    }
    </script>
    </head>

    <body>
    <td colspan="4" id="gjdw0">
    <%
    if(user.getGjdw()==null)
    {
    user.setGjdw("");
    }
    %>
    <input type="button" value="增加" onclick="add()"/>
    <input type="button" value="减少" onclick="del()"/>
    </td>
    </body>

  • 相关阅读:
    iOS -一些常用的方法
    handoff了解
    UIlabel
    扩展运行机制
    github -- fork提交项目
    iOS
    AppDelegate解析
    KVC
    KVO
    xcode升级后, 插件失效修复
  • 原文地址:https://www.cnblogs.com/iCheny/p/8798881.html
Copyright © 2011-2022 走看看