2

This is my code for one timePicker but i am unable to show two timePickers on one HTML page. The below code is working fine for my one timePicker but i am unable to make Logic that how i should use id's which are different on both inputs .

    function redirect(){

  document.getElementById("startTime").value=document.getElementById("test_default").value;

           var stime=document.getElementById("test_default").value;

    //alert(document.getElementById("endTime").value);

              window.localStorage.setItem('starttime', stime);

    //alert(stime);
         window.localStorage.setItem('id', id);
         window.location.replace("block.html");


          }
             function frameURL() {
        /*var address = document.getElementById("startTime");
        //var iframe = document.getElementById("iframe");
        //var frame = iframe.src;
        //address.value = frame;


             var iframe = document.getElementById('iframe');
             var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
             var usernameTextBox = innerDoc.getElementById('test_default');

    //usernameTextBox.focus();
            address.value = usernameTextBox;
            alert(usernameTextBox);
    //usernameTextBox.focus();*/

            var thetime= document.getElementById('iframe').contentWindow.document.getElementById("startTime").value;

              document.getElementById("startTime").value=thetime
         }



            function frameURL2() {


             var thetime=        document.getElementById('iframe1').contentWindow.document.getElementById("startTime").value;

       //alert(thetime);


           document.getElementById("startTime1").value=thetime
         }

          </script>
Harshit Tailor
  • 3,261
  • 6
  • 27
  • 40
  • So no one can help ..:) –  Feb 15 '13 at 13:00
  • 1
    What's the point of all the comments? Why are you making us read all that code you're not using? Where is the code for the second time picker? – robertc Feb 15 '13 at 14:57

2 Answers2

0

I used this: timepicker along with jqueryui's Datepicker.

HTML

<input class='timePicker' name='time_start'type='text' />
<input class='timePicker' name='time_end'type='text' />

jQuery

$(document).ready(function(){
    $('.timePicker').timepicker({
        timeFormat: 'hh:mm TT',
    });
});
0

Try to use jQuery timePicker. Just add 1 css & 1 Js file and you can use timePicker . This is the timePicker which i have used it's very easy to use. Jquery 1.6.4. Place your both Text Boxes in one div & place the id of that div in this JavaScript.

<script type="text/javascript" charset="utf-8" >

        $(document).ready(function(){
            // find the input fields and apply the time select to them.
            $('#sample1 input').ptTimeSelect();
        });
    </script>
Asteriskiiii
  • 499
  • 6
  • 14
  • 1
    thnx @ PhoneGap Developer i am going to tyr this timePicker now . –  Feb 22 '13 at 06:35