2017-07-26 28 views
0

私はASPのクラシックとモーダルで作業しています。私は、tmshiftotというルートフォルダにあるページを持っています。 tmshiftot showボタンをクリックすると、ajax関数が表示され、サブフォルダにある別のページのコンテンツを表示します。ページの別のリンクをクリックするとモーダルフォームがポップアップします。モーダルのdivと関数はルートフォルダのページtmshiftotにあり、モーダルのフォームはサブフォルダにあります。すべての私のjsとcssファイルもサブフォルダにあります。Datepickerはモーダルで表示されません

ただし、日付ピッカーは読み込まれません。私はdatepickerのjsとcssをどこに置くべきかわからないし、いくつかのリンクの問題があると思う。助けてください、どうもありがとうございます。

デバッグ時にエラーが含まれています。あなたの助けは喜んで感謝しています。

The file structure

Running debugger and the erros

サブフォルダアヤックスでもアヤックス

<!DOCTYPE html> 
<html> 
<head> 
<title></title> 
<!-- #include file="../include/connection.asp" --> 
<!-- #include file="../include/proc.asp" --> 
<!-- #include file="../include/option.asp" --> 
<!-- #include file="../include/adovbs.inc" --> 
<!-- #include file="../include/validate.asp" --> 

<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 


</head> 
<body> 
<div class="col-sm-12" style="overflow:auto;padding:0px;margin:0px"> 

<table id="example1" class="table table-bordered table-striped"> 

    <thead> 
     <% 
      response.write "<tr>" 
       response.write "<th>Month</th>" 
       For i = 1 to 31 
        if i < 10 then 
         i = "0" & i 
        end if 
        response.write "<th>" & i & "</th>" 
       next 
      response.write "<tr>"  
     %>    
    </thead> 
    <tbody> 
     <% 
      sURL = "&page=" & PageNo & "&txtEMP_ID=" & sEMP_ID 
      sEMP_ID = request("txtEMP_ID") 
      sBegMonth = CInt(request("txtMonth")) 
      sBegYear = CInt(request("txtYear")) 
      sEndMonth = CInt(sBegMonth) + 12 

      do while sBegMonth <=sEndMonth 

       sMonth = sBegMonth 
       sYear = sBegYear 
       if sMonth > 12 then 
        sMonth = sBegMonth mod 12 
        sYear = sBegYear + 1 
       end if       

       response.write "<tr>" 
       response.write "<td>" & MonthName(sMonth,True) & "</td>" 

        For j = 1 to 31 

         sDate = j & "/" & sMonth & "/" & sYear 

         if IsDate(sDate) then 'Check if the date is valid 
          if weekday(sDate, 1) = 1 then 'Check if it is Sunday 
           response.write "<td bgcolor='#F08080'><a href='#' style='display:block;' data-toggle=""modal"" data-target=""#modal-shiftotentry"" data-emp_id=" & sYear & " data-sdate=" & sDate & ">&nbsp;</a></td>" 
          else 
           response.write "<td><a href='#' style='display:block;' data-toggle=""modal"" data-target=""#modal-shiftotentry"" data-emp_id=" & sYear & " data-sdate=" & sDate & ">&nbsp;</a></td>" 
          end if 
         end if  
        next 
        response.write "</tr>" 

      sBegMonth = sBegMonth + 1 

      loop 
     %>      
    </tbody> 
</table> 
</div> 
</body> 
</html> 

MODALコードページと呼ばれるサブフォルダにルートページtmshiftot.asp

<!DOCTYPE html> 
<html> 
<head> 
<!-- #include file="include/connection.asp" --> 
<!-- #include file="include/proc.asp" --> 
<!-- #include file="include/option.asp" --> 
<!-- #include file="include/adovbs.inc" --> 
<!-- #include file="include/validate.asp" --> 

<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<title>IQOR</title> 
<!-- Tell the browser to be responsive to screen width --> 
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> 
<!-- Bootstrap 3.3.6 CSS --> 
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> 
<!-- DataTables --> 
<link rel="stylesheet" href="dist/css/dataTables.bootstrap.css"> 
<!-- Font Awesome --> 
<link rel="stylesheet" href="font_awesome/css/font-awesome.min.css"> 
<!-- Ionicons --> 
<link rel="stylesheet" href="ionicons/css/ionicons.min.css"> 
<!-- Theme style --> 
<link rel="stylesheet" href="dist/css/AdminLTE.min.css"> 
<!-- AdminLTE Skins. Choose a skin from the css/skins 
    folder instead of downloading all of them to reduce the load. --> 
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css"> 
<!-- Jquery 1.12.0 UI CSS --> 
<link rel="stylesheet" href="plugins/jQuery-ui/1.12.0/Css/jquery-ui.css"/> 
<!-- Date Picker --> 
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css" /> 

</head> 
<% 
    sMonth = Month(Date) 
    sYear = Year(Date) 
%> 

<body class="hold-transition skin-blue sidebar-mini"> 
    <div class="wrapper"> 

    <!-- #include file="include/header.asp" --> 
    <!-- Left side column. contains the logo and sidebar --> 
    <!-- #include file="include/sidebar_tm.asp" --> 

    <!-- Content Wrapper. Contains page content --> 
    <div class="content-wrapper"> 
     <!-- Content Header (Page header) --> 
     <section class="content-header"> 
      <h1>Time Clock Entry </h1> 
     </section> 
     <!-- Main content --> 
     <section class="content"> 
      <div class="row"> 
       <div class="col-md-12"> 
        <div class="box"> 
         <!-- /.box-header --> 
         <div class="box-body "> 
          <form name="form1" class="form-horizontal" action="tmshiftot.asp" method="POST"> 
           <div class="form-group"> 
            <label class="col-sm-2 control-label">Employee ID : </label> 
            <div class="col-sm-3"> 
             <div class="input-group"> 
              <input class="form-control" id="txtID" name="txtID" value="<%=sID%>" maxlength="6"> 
              <span class="input-group-btn"> 
               <a href="#" name="btnSearchID" id="btnSearchID" class="btn btn-default" 
                data-toggle="modal" data-target="#modal-userID"> 
                <i class="fa fa-search"></i> 
               </a> 
              </span> 
             </div> 
            </div> 
            <div class="col-sm-2"> 
             <button type="submit" id="btnShow" name="btnShow" class="btn btn-default" 
              onclick="showContent();return false;" style="width: 90px"> 
              Show</button> 
            </div> 
           </div> 
           <div class="form-group"> 
            <label class="col-sm-2 control-label">Start From : </label> 
            <div class="col-sm-1" style="width:100px"> 
             <div class="input-group"> 
              <select name="selMonth" id="selMonth" class="form-control"> 
               <%For j = 1 to 12 %>               
                <option value="<%=j%>" <%if sMonth = j then%>Selected<%end if%>><%=MonthName(j,true)%></option> 
               <%Next%> 
              </select> 
             </div> 
            </div> 
            <div class="col-sm-2"> 
             <div class="input-group"> 
              <select name="selYear" id="selYear" class="form-control"> 
               <%For i = 1 to 30 
                selyear = Cint(2016) + Cint(i) 
               %> 
                <option value="<%=selyear%>" <%if sYear = selyear then%>Selected<%end if%>><%=selyear%></option> 
               <%Next%> 

              </select> 
             </div> 
            </div> 
           </div> 
          </form> 
          <div id="searchresult"> 
           <!-- CONTENT HERE --> 
          </div> 
         </div> 
         <!-- /.box-body --> 
        </div> 
       </div> 
       <!-- /.col --> 
      </div> 
      <!-- /.row --> 
      <div class="modal fade bd-example-modal-lg" id="modal-userID" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"> 
       <div class="modal-dialog modal-lg" role="document"> 
        <div class="modal-content"> 
         <div class="modal-header"> 
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 
           <span aria-hidden="true">&times;</span></button> 
         </div> 
          <div id="userID"> 
           <!--- Content ----> 
          </div> 
        </div> 
       </div> 
      </div> 
      <div class="modal fade" id="modal-shiftotentry"> 
       <div class="modal-dialog"> 
        <div class="modal-content"> 
         <div class="modal-header"> 
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 
           <span aria-hidden="true">&times;</span></button> 
          <h4 class="modal-title">Shift Maintenance Entry</h4> 
         </div> 
         <div class="modal-body"> 
          <div id="shiftotentry"></div> 
         </div> 
        </div> 
       <!-- /.modal-content --> 
       </div> 
       <!-- /.modal-dialog --> 
      </div> 
      <!-- /.modal --> 
     </section> 
     <!-- /.content --> 
    </div> 
    <!-- /.content-wrapper --> 

    <!-- #include file="include/footer.asp" --> 
</div> 
<!-- ./wrapper --> 
<!-- JQuery 2.2.3 Compressed --> 
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script> 
<!-- Bootstrap 3.3.6 --> 
<script src="bootstrap/js/bootstrap.min.js"></script> 
<!-- Jquery 1.12.0 UI --> 
<script src="plugins/jQuery-ui/1.12.0/jquery-ui.js"></script> 
<!-- Jquery for autocomplete --> 
<script src="plugins/jQueryAutoComplete/jquery.ui.autocomplete.scroll.min.js"></script> 
<!-- SlimScroll --> 
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script> 
<!-- FastClick --> 
<script src="plugins/fastclick/fastclick.js"></script> 
<!-- AdminLTE App --> 
<script src="dist/js/app.min.js"></script> 
<!-- datepicker --> 
<script src="plugins/datepicker/bootstrap-datepicker.js"></script> 

<script> 
$(document).ready(function(){ 
    document.getElementById('txtID').focus(); 
    }); 

$(function() { 
    $("#btnShow").click(function() { 
     $("#searchresult").show(); 
    }); 
}); 

</script> 

<script> 
function getValue(svalue) 
    { 
     document.getElementById("txtID").value = svalue; 
     $('#modal-userID').modal('hide'); 
    } 

    $('#modal-userID').on('show.bs.modal', function (event) { 
     var button = $(event.relatedTarget) // Button that triggered the modal 
     var modal = $(this) 
     showDetails('page=1') 
    }) 

function showDetails(str){ 
    var xhttp; 

    xhttp = new XMLHttpRequest(); 
    xhttp.onreadystatechange = function() { 
     if (xhttp.readyState == 4 && xhttp.status == 200) { 
     document.getElementById("userID").innerHTML = xhttp.responseText; 
     } 
    }; 

    var search = document.getElementById("txtID"); 
    if (search != null && search != "") 
    { 
     str = str + "&txtEMP_ID=" + search.value; 
    } 

    xhttp.open("GET", "ajax/ax_view_userID.asp?"+str, true); 
    xhttp.send(); 

} 
</script> 

<script> 
function showContent() { 
    var xhttp; 

    xhttp = new XMLHttpRequest(); 
    xhttp.onreadystatechange = function() { 
     if (xhttp.readyState == 4 && xhttp.status == 200) { 
     document.getElementById("searchresult").innerHTML = xhttp.responseText; 
     } 
    }; 

    str = "txtEMP_ID=" + document.getElementById("txtID").value; 
    str = str + "&txtMonth=" + document.getElementById("selMonth").value 
    str = str + "&txtYear=" + document.getElementById("selYear").value 
    xhttp.open("GET", "ajax/ax_tmshiftot_info.asp?"+str, true); 
    xhttp.send(); 
} 
</script> 


<script> 
     $('#modal-shiftotentry').on('show.bs.modal', function (event) { 
     var button = $(event.relatedTarget) // Button that triggered the modal 
     var recipient = button.data('sdate') 
     recipient = recipient + "," + button.data('emp_id') 
     var modal = $(this) 
     modal.find('.modal-body input').val(recipient) 
     showDetails2(recipient) 
    }) 

function showDetails2(str){ 
    var xhttp; 

    xhttp = new XMLHttpRequest(); 
    xhttp.onreadystatechange = function() { 
     if (xhttp.readyState == 4 && xhttp.status == 200) { 
     document.getElementById("shiftotentry").innerHTML = xhttp.responseText; 
     } 
    }; 

    xhttp.open("GET", "ajax/ax_tmshiftot_entry.asp?txtstring="+str, true); 
    xhttp.send(); 

} 
</script> 
</body> 
</html> 

コンテンツページ

<!-- #include file="../include/connection.asp" --> 
<!-- #include file="../include/adovbs.inc"--> 
<!-- #include file="../include/proc.asp"--> 

<% 
sMode = request("Mode") 
sString = request("txtstring") 
    if sString <> "" then 
     sSplit = split(sString,",") 
     sDate = sSplit(0) 
     sEMP_ID = sSplit(1) 
    end if 

sModeSub = reqform("sub") 
sShift_Code = reqform("txtShift_Code") 
sID = UCase(reqform("txtEMP_ID")) 
dt_Date = fdate2(reqform("txtdt_date")) 

if sModeSub = "up" then 
    sSQL = "UPDATE TMSHIFTOT SET "    
    sSQL = sSQL & " SHIFT_CODE = '" & sShift_Code & "'," 
    sSQL = sSQL & " WHERE DT_SHIFT = '" & dt_Date & "'" 
    sSQL = sSQL & " AND EMP_ID = '" & sID & "'" 
    conn.execute sSQL 

    call confirmBox("Update Successful!", "tmshiftot.asp") 

elseif sModeSub = "save" then 
    sSQL = "insert into TMSHIFTOT (EMP_ID,DT_SHIFT,SHIFT_CODE,USER_ID,DATETIME) " 
    sSQL = sSQL & "values (" 
    sSQL = sSQL & "'" & sID & "',"  
    sSQL = sSQL & "'" & dt_date & "'," 
    sSQL = sSQL & "'" & sShift_Code & "'," 
    sSQL = sSQL & "'" & session("USERNAME") & "'," 
    sSQL = sSQL & "'" & fdatetime2(Now()) & "'" 
    sSQL = sSQL & ") " 
    conn.execute sSQL 
end if 

Set rstTMSHIFTOT = server.CreateObject("ADODB.RecordSet")  
sSQL = "select * from TMSHIFTOT where DT_SHIFT ='" & fdate2(sDate) & "'" 
rstTMSHIFTOT.Open sSQL, conn, 3, 3 
    if not rstTMSHIFTOT.eof then 
     sShift_Code = rstTMSHIFTOT("SHIFT_CODE") 
    end if 
pCloseTables(rstTMSHIFTOT) 

%> 
<form class="form-horizontal" action="ax_tmshiftot_entry.asp" method="post"> 
<input type="hidden" name="txtEMP_ID" value='<%=sEMP_ID%>' /> 
<div class="modal-body"> 
    <div class="col-sm-12"> 
     <div class="row"> 
      <div class="form-group"> 
       <label class="col-sm-3 control-label">Employee ID : </label> 
       <div class="col-sm-8"> 
        <span class="mod-form-control"><% response.write sEMP_ID %></span> 
       </div> 
      </div> 
      <div class="form-group"> 
       <label class="col-sm-3 control-label">Shift Code : </label> 
       <div class="col-sm-8"> 
        <input class="form-control" name="txtShift_Code" value="<%=sShift_Code%>" maxlength="30"> 
       </div> 
      </div> 
      <div class="form-group"> 
       <label class="col-sm-3 control-label">Dates From : </label> 
       <div class="col-sm-8 col-lg-8"> 
        <div class="input-group"> 
         <input id="dt_From" name="dt_From" value="<%=sDate%>" type="text" class="form-control"> 
         <div class="input-group-addon" style="background-color: gainsboro"> 
          <span><b>To</b></span> 
         </div> 
         <input id="dt_To" name="dt_To" value="<%=dt_To%>" type="text" class="form-control"> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
<div class="modal-footer"> 
    <div class="col-sm-12"> 
     <%if sMode = "N" then %> 
      <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> 
      <button type="submit" name="sub" value="up" class="btn btn-info pull-left" style="width: 90px">Update</button> 
     <%else %> 
      <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> 
      <button type="submit" name="sub" value="save" class="btn btn-primary-left" style="width: 90px">Save</button> 
     <%end if %> 
    </div> 
</div> 
</form> 

<link rel="stylesheet" href="plugins/datepicker/datepicker3.css" /> 
<!-- JQuery 2.2.3 Compressed --> 
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script> 
<!-- Bootstrap 3.3.6 --> 
<script src="bootstrap/js/bootstrap.min.js"></script> 
<!-- datepicker --> 
<script src="plugins/datepicker/bootstrap-datepicker.js"></script> 

<script> 
$(function() { 
    //Date picker 
    $("#dt_From").datepicker({ 
    autoclose: true, format: "dd/mm/yyyy" 
    }).datepicker("setDate", new Date()); 
}); 
</script> 

答えて

0

function showContent() { 
    var xhttp; 

    xhttp = new XMLHttpRequest(); 
    xhttp.onreadystatechange = function() { 
     if (xhttp.readyState == 4 && xhttp.status == 200) { 
     document.getElementById("content2").innerHTML = xhttp.responseText; 
     $("[data-mask]").inputmask(); 
     $("[date-picker]").datepicker({ 
     format: "dd/mm/yyyy", 
     autoclose: true, 
     }).datepicker("setDate", new Date()); 


     } 
    }; 

    xhttp.open("GET", "ax_test.asp?", true); 
    xhttp.send(); 
} 
</script> 
0

tmshiftot.aspファイルのインクルードファイルのすべてのパスは、ルートフォルダに基づいているようです。

ただし、MODAL CODEでは、インクルードファイルの親パス(../)を参照しています。

私はMODAL CODEがサブフォルダにあると推測していますが、ルートフォルダ内のスクリプトからINCLUDEされた場合、HTMLの相対参照は元のスクリプトのURLに基​​づいています。付属のスクリプトのサブフォルダ。

は、次の行を変更してみてください...

<link href="../plugins/datepicker/datepicker3.css" rel="stylesheet" /> 
<!-- JQuery 2.2.3 Compressed --> 
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script> 
<script src="../plugins/datepicker/bootstrap-datepicker.js"></script> 

...へ...

<link href="plugins/datepicker/datepicker3.css" rel="stylesheet" /> 
<!-- JQuery 2.2.3 Compressed --> 
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script> 
<script src="plugins/datepicker/bootstrap-datepicker.js"></script> 

より良い(プラグインフォルダがルートであると仮定)実際には絶対参照を使用することです。これは、参照がルートフォルダに相対的であることを意味します。絶対参照は/で始まります。あなたは両方のASPでこれを行うことができ

ではなく、ファイルの仮想使用しています(。例えば、スクリプト、リンク、IMG、等)

<!-- #include virtual="/include/yourfile.asp" --> 

をし、HTML内の任意の参照:

<script src="/folder/filejs"></script> 

これが答えでない場合は、ウェブデベロッパーツールコンソールからエラーを投稿してください。基本的にはShowcontent(で、次の部分を追加し

+0

こんにちはJohnaは、ここに私を助けてどうもありがとうございました。私はあなたの提案に続き、すべてのCSSとJSのリンクを変更しました。しかしモーダルはまだロードされません。オリジナルの投稿を編集し、フォルダ構造とデバッグ中のエラーを表示するコードとビデオを含めました。あなたの助けは喜んで感謝しています。 –

+0

それぞれの 'script'と' link' includeのそれぞれのパスの先頭に '/'または '/ iqor /'を追加してみてください。 – johna

関連する問題