Please Enable JavaScript!
Gon[ Enable JavaScript ]

반응형

<script language="javascript">

<!--

function add(){

   var target = document.getElementById("dynamicTable");

   var currentRowIndex = target.rows.length;

   var row = target.insertRow(-1);

   var cell = row.insertCell(-1);

   cell.innerHTML = "<input type='text' name='point"+ currentRowIndex +

         "' size='5' maxlength=='5' value='20'>&nbsp;&nbsp;" +

         "<select name='scope" + currentRowIndex + "'>" +

         "<option>초과</option>" +

         "<option>이상</option>" +

         "<option>이하</option>" +

         "<option>미만</option>" +

         "</select>";

}

 

function checkToggle(form){

   var i=1;

   var isDisabled = (form.auto.checked) ? true : false;

   while(true){

      var scopeElement = form["scope" + i];

      var pointElement = form["point" + i++];

      if (scopeElement){

          scopeElement.disabled = isDisabled;

          pointElement.disabled = isDisabled;

      }else{

          break;

      }

   }

}

//-->

</script>

</head>

 

<body>

<form name="form">

   <input type="checkbox" name="auto" onclick="checkToggle(this.form)"> Disabled 된다

   <input type="button" value="add" onclick="add()">행추가

   <table id="dynamicTable" border="0" cellpadding="5" cellspacing="1" align="center">

     <thead>

       <tr align="center">

         <td width="130">점수</td>

       </tr>

     </thead>

     <tbody>

        <tr align="center">

           <td colspan="4">

      <input type="text" name="point1" size="5" maxlength="5" value="20">

      &nbsp;&nbsp;

              <select name="scope1">

                 <option>초과</option>

                 <option>이상</option>

                 <option>이하</option>

                 <option>미만</option>

              </select>

            </td>

        </tr>

     </tbody>

  </table>

</form>

</body>
반응형
Posted by 녹두장군1
,