0

この行を入れると、 $('#startdate').mask("99/99/999"); JS ファイル全体が起動しません。

$(document).ready(function () {

$('#startdate').mask("99/99/999");

$('#startdate').bind("change paste keyup", function () {

$('#table_id').dataTable().fnDraw(); });
$('#enddate').bind("change paste keyup", function () {   

$('#table_id').dataTable().fnDraw(); });

$('#csearchtext').bind("change paste keyup", function () {

    var input = $('#csearchtext').val();
    var dropdownindex = $("select[name='columnlist'] option:selected").index();
    var radioselected = $("input:radio[name='group2']:checked").val();
    var searchpattern = '';

    switch (radioselected) {
        case '1':
            searchpattern = '^' + input;
            break;
        case '2':
            searchpattern = input;
            break;
        case '3':
            searchpattern = input + '$';
            break;
    }

    $('#table_id').dataTable().fnFilter(searchpattern, dropdownindex + 1, true, true, true, false);

});

$('#columnlist').on('change', function () {

    $('#table_id').dataTable().fnFilterClear();

});

$('#dblist').on('change', function () {

    var selected = $('#dblist').find(":selected").text();
    tablefill(selected);

});

$('#search').click(function () {

    var selected = $('#dblist').find(":selected").text();
    tablefill(selected);

});

function tablefill(selected) {
    $('.advsearchbar').show();
    $('#stable').show();

    $('#table_id').dataTable({
        "sAjaxSource": '/php/connect/searchtablequery.php',
        "bProcessing": true,
        "sScrollY": "500px",
        "bDeferRender": true,
        "bDestroy": true,
        "sAjaxDataProp": "",
        "fnServerParams": function (aoData) {
            aoData.push({ "name": "db", "value": selected });
        },
        "aoColumns": [
            { "mData": "calldate" },
            { "mData": "recordingfile" },
            { "mData": "uniqueid" },
            { "mData": "src" },
            { "mData": "did" },
            { "mData": "lastapp" },
            { "mData": "dst" },
            { "mData": "disposition" },
            { "mData": "duration" },
            { "mData": "userfield" },
            { "mData": "accountcode"}],
        "iDisplayLength": 20,
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        "sDom": '<"H"Tfr>t<"F"ip>',
        "oTableTools": {
            "sSwfPath": "/DataTables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
            "aButtons": [
                "copy", "csv", "xls", "pdf",
                {
                    "sExtends": "collection",
                    "sButtonText": "Save",
                    "aButtons": ["csv", "xls", "pdf"]
                }]
        }
    });
}
});

html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title></title>

    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" href="/css/table.css">
    <link rel="stylesheet" href="/css/layout.css">

    <script type="text/javascript" charset="utf-8" src="/DataTables/media/js/jquery.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/userdblist.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/jquerymask.js"></script>


</head>

<body>

<?php include 'navpanel.php'; ?>

    <div class="container">
        <div class="form-bg1">
            <form id="login_form2">
                <table class="bordered">                   
                   <thead>
                       <tr>               
                           <th>DB List & Search</th>
                           <th></th>
                           <th></th>
                           <th></th>
                       </tr>
                   </thead>
                   <tr>
                       <td>Database</td>
                       <td>
                           <select name="dblist" id="dblist">
                           <?php foreach ($dbresult as $row): ?>
                               <option><?=$row["DBNick"]?></option>
                           <?php endforeach ?>
                           </select>
                       </td>
                       <td><input class="search" id="search" value="Select" type="button"></input></td>
                       <td></td>
                   </tr>
                   <tr class="advsearchbar" style="display: none">
                       <td>Column<br><br>Search</td>
                       <td>
                            <select name="columnlist" id="columnlist">
                                <option>Recording</option>
                                <option>System</option>
                                <option>Outbound CallerID</option>
                                <option>DID</option>
                                <option>App</option>
                                <option>Destination</option>
                                <option>Disposition</option>
                                <option>Duration</option>
                                <option>User</option>
                                <option>Account</option>                                                        
                            </select>                              
                           <input type="text" name="csearchtext" id="csearchtext">
                       </td>
                       <td>                              
                           <input type="radio" name="group2" value="1">Start With<br>
                           <input type="radio" name="group2" value="2" checked>Contains<br> 
                           <input type="radio" name="group2" value="3">Ends With
                       </td>
                       <td>
                           From Date<input type="text" name="startdate" id="startdate" value="2013-08-13" size="10px">
                           H<input type="text" name="startdatehour" id="startdatehour" size="1px">
                           M<input type="text" name="startdatemin" id="startdatemin" size="1px">
                           <br>
                           To Date&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="enddate" id="enddate" size="10px">
                           H<input type="text" name="enddatehour" id="enddatehour" size="1px">
                           M<input type="text" name="enddatemin" id="enddatemin" size="1px">
                       </td>
                   </tr>  
                </table>
            </form>    
        </div>
    </div>

    <?php include('searchtable.php');?>


</body>

プラグインとjqueryからjsファイルを含めたので、なぜ機能しないのかわかりません。どんな助けでも本当に感謝しています。

4

1 に答える 1

0

$('#startdate').mask("9999/99/99"); $('#startdate').mask("9999/99/99"); の下の php ページに配置することで機能します。jsファイルにはありません。他のすべてが正常に機能するため、理由はわかりません。

于 2013-09-17T15:36:02.237 に答える