PHP:DatePicker /日历不显示

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/.

我有两个表单我命名为main.php和sample.php ....对于main.php我有 日历/日期选择器及其工作。 但是当我进入下一页或者sample.php时,日历/日期选择器不再显示...我只是将代码从main.php复制到sample.php p>

这是我的main.php代码: p>

 &lt; link rel =“stylesheet”href =“http://code.jquery.com/ui/1.10.3/themes  /smoothness/jquery-ui.css“/&gt; 
&lt; script src =”http://code.jquery.com/jquery-1.9.1.js“&gt;&lt; / script&gt; 
&lt; script src =  “http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel =”stylesheet“href =”/ resources / demos / style.css  “/&gt; 
 
&lt; script&gt; 
 $(function(){
 $(”#datepickerfrom“)。datepicker(); 
}); 
 
 $(function(){
  $(“#datepickerto”)。datepicker(); 
}); 
&lt; / script&gt; 
 
From:&lt; input type =“text”id =“datepickerfrom”name =“from”&gt; 收件人:&lt; input type =“text”id =“datepickerto”name =“to”&gt; 
  code>  pre> 
 
 

并且对于sample.php: p> \ n

 &lt; link rel =“stylesheet”href =“http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css”/&gt; \  n&lt; script src =“http://code.jquery.com/jquery-1.9.1.js”&gt;&lt; / script&gt; 
&lt; script src =“http://code.jquery.com/  ui / 1.10.3 / jquery-ui.js“&gt;&lt; / script&gt; 
&lt; link rel =”stylesheet“href =”/ resources / demos / style.css“/&gt; 
&lt; script src  =“http://code.jquery.com/jquery-latest.js”&gt;&lt; / script&gt; 
&lt; script&gt; 
 
 $(function(){
 $('。checkall')  .on('click',function(){
 $(this).closest('fieldset')。find(':checkbox')。prop('checked',this.checked); 
}); \  n}); 
 
 $(function(){
 $(“#datepickerfrom”)。datepicker(); 
}); 
 
 $(function(){
 $(“#datepickerto  “)。datepicker(); 
}); 
&lt; / script&gt; 
 
 From:&lt; input type =”text“id =”datepickerfrom“name =”from“&gt; 要:&lt; input type =“text”id =“datepickerto”name =“to”&gt; 
 
&lt;?php 
echo“&lt; div&gt;&lt; input type ='checkbox'class ='checkall'&gt  ;检查所有&lt; / div&gt;“; 
?&gt; 
  code>  pre> 
 
 

但是在sample.php中我添加了一个代码,用于复选框所有我也使用脚本的地方 ... p>

谢谢/. p> div>

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

<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>  

You need those lines on sample.php, tried it, it worked.