Click here to Skip to main content
15,918,041 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Angular JS Pin
Kornfeld Eliyahu Peter30-Jun-14 21:41
professionalKornfeld Eliyahu Peter30-Jun-14 21:41 
AnswerRe: Angular JS Pin
gaupoit3-Jul-14 5:27
gaupoit3-Jul-14 5:27 
Questionhow to get data from json url ? Pin
Tamil Purushothaman29-Jun-14 20:43
Tamil Purushothaman29-Jun-14 20:43 
AnswerRe: how to get data from json url ? Pin
Graham Breach29-Jun-14 22:18
Graham Breach29-Jun-14 22:18 
Questionmouseout isn't firing Pin
ThetaClear29-Jun-14 1:34
ThetaClear29-Jun-14 1:34 
AnswerRe: mouseout isn't firing Pin
ThetaClear29-Jun-14 23:21
ThetaClear29-Jun-14 23:21 
AnswerRe: mouseout isn't firing Pin
Kornfeld Eliyahu Peter30-Jun-14 1:16
professionalKornfeld Eliyahu Peter30-Jun-14 1:16 
GeneralRe: mouseout isn't firing Pin
ThetaClear30-Jun-14 1:26
ThetaClear30-Jun-14 1:26 
GeneralRe: mouseout isn't firing Pin
ThetaClear30-Jun-14 3:38
ThetaClear30-Jun-14 3:38 
AnswerRe: mouseout isn't firing Pin
Kornfeld Eliyahu Peter30-Jun-14 3:43
professionalKornfeld Eliyahu Peter30-Jun-14 3:43 
GeneralRe: mouseout isn't firing Pin
ThetaClear30-Jun-14 4:22
ThetaClear30-Jun-14 4:22 
GeneralRe: mouseout isn't firing Pin
Kornfeld Eliyahu Peter30-Jun-14 7:11
professionalKornfeld Eliyahu Peter30-Jun-14 7:11 
AnswerRe: mouseout isn't firing Pin
User 483504730-Jun-14 8:41
User 483504730-Jun-14 8:41 
AnswerRe: mouseout isn't firing Pin
Kornfeld Eliyahu Peter30-Jun-14 9:21
professionalKornfeld Eliyahu Peter30-Jun-14 9:21 
GeneralRe: mouseout isn't firing Pin
User 483504730-Jun-14 9:49
User 483504730-Jun-14 9:49 
AnswerRe: mouseout isn't firing Pin
Kornfeld Eliyahu Peter30-Jun-14 9:58
professionalKornfeld Eliyahu Peter30-Jun-14 9:58 
GeneralRe: mouseout isn't firing Pin
ThetaClear1-Jul-14 1:10
ThetaClear1-Jul-14 1:10 
AnswerRe: mouseout isn't firing Pin
DecompileCodex18-Jul-14 21:19
DecompileCodex18-Jul-14 21:19 
QuestionS code to have an image with different clickable points that play sound Pin
Jennifer Estrada26-Jun-14 13:27
Jennifer Estrada26-Jun-14 13:27 
AnswerRe: S code to have an image with different clickable points that play sound Pin
Kornfeld Eliyahu Peter29-Jun-14 1:50
professionalKornfeld Eliyahu Peter29-Jun-14 1:50 
Questiondevextreme mobile apps call webmethod return only html source code Pin
Member 938843524-Jun-14 16:29
Member 938843524-Jun-14 16:29 
QuestionI am having problem invoking form fields from my js. Any ideas? Pin
samflex24-Jun-14 4:32
samflex24-Jun-14 4:32 
VB

Greetings Experts,

I have the following javascript:

VB
<script type="text/javascript">
    $(document).ready(function () {

        $('#txtToDate').datepicker({ showOn: 'button',
            buttonImage: 'images/20/calendar200.gif',
            buttonImageOnly: true, onSelect: function (dateText, inst) {
                //Calculate the days here
                var days = ($("#txtToDate").datepicker('getDate') - $("#txtFromDate").datepicker('getDate')) / (24 * 60 * 60 * 1000);
                //Assign it to textbox
                $('#numOfDays').val(days);
            },
            onClose: function () { $(this).focus(); }
        });

        $('#txtFromDate').datepicker({ showOn: 'button',
            buttonImage: 'images/20/calendar200.gif',
            buttonImageOnly: true, onSelect:
        function (dateText, inst) {
            $('#txtToDate').datepicker("option", 'minDate', new Date(dateText));
        }
      ,
            onClose: function () { $(this).focus(); }
        });


    });  
    </script>

   <script type='text/javascript'>//<![CDATA[
       $(window).load(function () {
           //Attach click event to button
           $('#Button1').on('click', function () {
               //Get Values from dropdownlist
               var sHour = $('#startHour').val(),
                eHour = $('#endHour').val();

               //create date format from dropdownlist selected values      
               var timeStart = new Date(txtFromDate + sHour).getHours();
               var timeEnd = new Date(txtToDate + eHour).getHours();

               //Calulate the time difference
               var hourDiff = timeEnd - timeStart;

               //Check if hour difference is less than or equal to 2 hours and show the message accordingly
               if (hourDiff <= 2) {
                   alert("A mininum of 2 hours per reservation is required!");
               }
           });
       });//]]>  

</script>


PHP
<asp:TextBox ID="txtFromDate" class="fptextbox12"  placeholder="MM/DD/YYYY" runat="server"  style="width:160px;"></asp:TextBox>
<asp:TextBox ID="txtToDate" class="fptextbox12"  placeholder="MM/DD/YYYY" runat="server"  style="width:160px;"></asp:TextBox>


The top part of Javascript is used for our datepicker functionality.

A user selects a startdate and an enddate and the total number of days between the startdate and enddate are stored in a control ID called numOfDays.

This works fine.

The second part of the javascript is where I am having issues.

A user selects start time and end time.

If the difference between starttime and endtime is not up to atleast 2 hours, the user is notified that a minimum of two hours is required.

The issue is that I am trying to store the value of startDate and endDate in the two lines below and append time to them but this not working:

PHP
//create date format from dropdownlist selected values
var timeStart = new Date(txtFromDate + sHour).getHours();
var timeEnd = new Date(txtToDate + eHour).getHours();


Any ideas what I am doing wrong?
AnswerRe: I am having problem invoking form fields from my js. Any ideas? Pin
Pablo Estrada24-Jun-14 4:57
Pablo Estrada24-Jun-14 4:57 
GeneralRe: I am having problem invoking form fields from my js. Any ideas? Pin
samflex24-Jun-14 5:11
samflex24-Jun-14 5:11 
GeneralRe: I am having problem invoking form fields from my js. Any ideas? Pin
Pablo Estrada30-Jun-14 7:01
Pablo Estrada30-Jun-14 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.