javascript date

Posted on 2011-10-24
Last Modified: 2012-05-12
Hi experts,

I need a code that fullfill fday, fmonth, fyear from start-date value.

here is my code

<form action="" method="post" target="_blank" id="formulaire_quicksearch">
<input type="hidden" name="lang" value="EN" />
<input type="hidden" name="hotelid" value="11907" />
<input type="hidden" name="fday" id="jour_arrivee" value=""/>
<input type="hidden" name="fmonth" id="mois_arrivee" value="" />
<input type="hidden" name="fyear" id="annee_arrivee" value="" />

Date d'arrivée:<input type="text" id="start-date" name="start-date" value=""/>
<br>Nuit(s):<select class="champ_quicksearch"  id="nombre_nuits" name="nbnights" ><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option></select>
<br>Adulte(s):<select class="champ_quicksearch"  id="nombre_adultes" name="nbadt" ><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>
<br><input class="champ_quicksearch" type="submit" value="Book" />
<br><a href="" title="Options" target="_blank" class="lien_quicksearch">Options</a>

Question by:erezabou
    LVL 81

    Expert Comment

    put this in the head section :

    <link rel="stylesheet" href="" type="text/css" media="all" />
    <script src="" type="text/javascript"></script>
    <script src="" type="text/javascript"></script>
    <script language="javascript" type="text/javascript"></script>
    $(document).ready(function() {
            onSelect: function(dateText, inst) {
                var dt = dateText.split("/");

    Open in new window

    after downloading them, put the js files on your own server (check the first lines)

    test page :
    LVL 29

    Expert Comment

    jQuery for this? Really?

    Put this in the <head> section of your page:
    function stuff_date() {
        var da = document.getElementById("start-date").value; // Start date
        var ra = da.split("/"); // Month, day and year (at least in the U.S.)
        document.getElementById("mois_arrivee").value = ra[0];
        document.getElementById("jour_arrivee").value = ra[1];
        document.getElementById("annee_arrivee").value = ra[2];
        return ra; // In case you need the M, D, and/or Y

    Open in new window


    Author Comment

    to leakim971:

    can you please check why your code is not working on my page.

    LVL 29

    Expert Comment

    Not willing to try my solution, eh?
    LVL 81

    Accepted Solution

    can't locate lines 4 to 15
    I only saw that :
    jQuery(function($){$( "#start-date" ).datepicker({}); $( "#end-date" ).datepicker({});});

    Open in new window


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now