doujian0265 2013-06-15 18:05
浏览 33
已采纳

PHP:DatePicker /日历不显示

I have two forms I named it main.php and sample.php.... For main.php I have a calendar/datepicker and its working. But then when I proceed to the next page or to the sample.php the calendar/datepicker its not displaying anymore... I just copy the codes from main.php to sample.php

Here's my code for main.php:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />

<script>
$(function() {
$( "#datepickerfrom" ).datepicker();
});

$(function() {
$( "#datepickerto" ).datepicker();
});
</script>

From: <input type="text" id="datepickerfrom"name="from"> To:  <input type="text" id="datepickerto"name="to">

And For sample.php:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>

$(function () {
    $('.checkall').on('click', function () {
        $(this).closest('fieldset').find(':checkbox').prop('checked', this.checked);
    });
});

    $(function() {
    $( "#datepickerfrom" ).datepicker();
    });

    $(function() {
    $( "#datepickerto" ).datepicker();
    });
    </script>

    From: <input type="text" id="datepickerfrom"name="from"> To:  <input type="text" id="datepickerto"name="to">

<?php
echo "<div><input type='checkbox' class='checkall'> Check all</div>";
?>

But in the sample.php I added a code for checkbox all where I also use a script...

Thanks/.

  • 写回答

2条回答 默认 最新

  • dongsu7049 2013-06-15 18:10
    关注

    Thats because you are calling jquery two times in sample.php. Either remove

    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    

    or

    <script src="http://code.jquery.com/jquery-latest.js"></script>
    

    P.S jquery-ui.js should come after jquery

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败