<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="manager.aspx.cs" MaintainScrollPositionOnPostBack="true" Inherits="CLIP.eForm.Consent.Web.manager" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title></title>
  <script src="jquery-1.8.3.min.js" type="text/javascript"></script>
  <script src="json2.js" type="text/javascript"></script>
  <script type="text/javascript">
    var doInsert = function () {
      //var ocrtag = document.getElementsByName("ocrtag").text();
      //var instcd = document.getElementsByName("instcd").text();
      var ocrtag = $('#ocrtag').val();
      var instcd = $('#instcd').val();
      if (ocrtag == undefined || ocrtag == '' || instcd == undefined || instcd == '') {
        alert('instcd 혹은 ocrtag 가 없습니다.');
        return;
      }
      else if (instcd == '031' || instcd == '032') {
        $.ajax({
          type: "POST",
          url: "manager.aspx/doInsert",
          data: '{"instcd":"' + instcd + '", "ocrtag":"' + ocrtag + '"}',
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (msg) {
            setResultTest(msg.d);
          }
        });
      }
      else {
        alert('instcd 가 잘못 입력되었습니다.');
        return;
      }
    };

    var setResultTest = function (msg) {
      $('#results').append(msg);
      //alert(msg);
    };
  </script>
</head>
<body>
  <form id="form1" runat="server">
    <div>
       <table>
         <tr>
           <td>변경할 OCRTAG</td>
           <td>instcd</td>
         </tr>
         <tr>
           <td><input id="ocrtag" onKeyup="this.value=this.value.replace(/[^0-9]/g,'');" maxlength="13"/></td>
           <td><input id="instcd" onKeyup="this.value=this.value.replace(/[^0-9]/g,'');" maxlength="3"/></td>
         </tr>
         <tr>
           <td></td>
         </tr>
       </table>
      <asp:Button ID="do" runat="Server" OnClientClick="doInsert(); return false;" text="실행"/>
      <div>
        <asp:TextBox Width="50%" ID="results"></asp:TextBox>
        <%--<a id="results" />--%>
      </div>      
      <%--<button onclick="doInsert">실행</button>--%>
    </div>
  </form>
</body>
</html>
