Click here to Skip to main content
15,896,912 members
Home / Discussions / JavaScript
   

JavaScript

 
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 
Questionproblem to enter to fullscreen mode when playing video using addEventListener Pin
Asaf Shay21-Jun-14 22:25
Asaf Shay21-Jun-14 22:25 
QuestionJavascript code to automatically check the checkbox of duplicate record in gridView Pin
Member 1048440017-Jun-14 20:41
Member 1048440017-Jun-14 20:41 
AnswerRe: Javascript code to automatically check the checkbox of duplicate record in gridView Pin
Raviranjan_Kumar_Sinha18-Jun-14 1:30
Raviranjan_Kumar_Sinha18-Jun-14 1:30 
QuestionJavascript Regex validation Pin
Arunkumar.Koloth9-Jun-14 19:36
Arunkumar.Koloth9-Jun-14 19:36 
AnswerRe: Javascript Regex validation Pin
Kornfeld Eliyahu Peter9-Jun-14 23:14
professionalKornfeld Eliyahu Peter9-Jun-14 23:14 
GeneralRe: Javascript Regex validation Pin
Arunkumar.Koloth9-Jun-14 23:25
Arunkumar.Koloth9-Jun-14 23:25 
AnswerRe: Javascript Regex validation Pin
Kornfeld Eliyahu Peter9-Jun-14 23:42
professionalKornfeld Eliyahu Peter9-Jun-14 23:42 
GeneralRe: Javascript Regex validation Pin
Member 1173096331-May-15 4:55
Member 1173096331-May-15 4:55 
Questionjquery and mootools Pin
Member 94738096-Jun-14 20:10
Member 94738096-Jun-14 20:10 
AnswerRe: jquery and mootools Pin
Kornfeld Eliyahu Peter9-Jun-14 20:25
professionalKornfeld Eliyahu Peter9-Jun-14 20:25 
Questionunable to get property 'childnodes' of undefined or null reference Pin
Member 105519074-Jun-14 5:01
Member 105519074-Jun-14 5:01 
AnswerRe: unable to get property 'childnodes' of undefined or null reference Pin
ZurdoDev4-Jun-14 7:07
professionalZurdoDev4-Jun-14 7:07 
AnswerRe: unable to get property 'childnodes' of undefined or null reference Pin
Kornfeld Eliyahu Peter4-Jun-14 9:00
professionalKornfeld Eliyahu Peter4-Jun-14 9:00 
AnswerRe: unable to get property 'childnodes' of undefined or null reference Pin
Raviranjan_Kumar_Sinha19-Jun-14 0:41
Raviranjan_Kumar_Sinha19-Jun-14 0:41 

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.