Click here to Skip to main content
15,175,716 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionJavascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Member 1510027614-Mar-21 22:50
MemberMember 1510027614-Mar-21 22:50 
AnswerRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Richard Deeming14-Mar-21 23:39
mveRichard Deeming14-Mar-21 23:39 
GeneralRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Member 1510027615-Mar-21 0:11
MemberMember 1510027615-Mar-21 0:11 
GeneralRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Richard Deeming15-Mar-21 0:29
mveRichard Deeming15-Mar-21 0:29 
GeneralRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Member 1510027615-Mar-21 8:56
MemberMember 1510027615-Mar-21 8:56 
GeneralRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Richard Deeming15-Mar-21 23:31
mveRichard Deeming15-Mar-21 23:31 
GeneralRe: Javascript CSP and CORS problem? How can I send Cookies with AJAX in CORS? Pin
Member 1510027616-Mar-21 7:49
MemberMember 1510027616-Mar-21 7:49 
Questionif statement not working Pin
chizzy4211-Mar-21 8:53
Memberchizzy4211-Mar-21 8:53 
Hi All, Hope all is well well. I have a coding question I cant seem to figure out. I have a form in HTML5 which has columns that I want to sum and show in a totals box. The totals are summed when a button that calls the sum() function when clicked. From the code below I'm just trying to sum two boxes which represent a value for each hour total. My problem is that when I click on the button with only a value in the first box, then i get a NaN in the results box...no matter how many times i click it...but when i enter a value in the second box the sum is completed and the correct total is displayed. Could someone explain please why this only works with 2 values and not just 1....hope this is clear. Thanks to all who try

regards

JavaScript
<pre><script type="text/javascript" ></script>
    <script type="text/javascript">
        function sum() {
	var result= 0;
        var txtFirstNo = document.getElementById('Text1').value;
        var txtSecondNo = document.getElementById('Text6').value;
			
	    if (!isNaN(txtFirstNo)){ 
		result = parseInt(txtFirstNo);
		document.getElementById('Tar').value = parseInt(result);
            }
            
            if (!isNaN(txtSecondNo)){ 
		result = parseInt(txtFirstNo) + parseInt(txtSecondNo);
		document.getElementById('Tar').value = result;
            }
            
           if (!isNaN(result)) {
                document.getElementById('Tar').value = result;
            }
	    
        }
    </script>


AnswerRe: if statement not working Pin
NotTodayYo11-Mar-21 9:24
MemberNotTodayYo11-Mar-21 9:24 
AnswerRe: if statement not working Pin
W Balboos, GHB11-Mar-21 9:45
mveW Balboos, GHB11-Mar-21 9:45 
GeneralRe: if statement not working Pin
chizzy4213-Mar-21 5:03
Memberchizzy4213-Mar-21 5:03 
GeneralRe: if statement not working Pin
Member 1510027615-Mar-21 9:15
MemberMember 1510027615-Mar-21 9:15 
GeneralRe: if statement not working Pin
chizzy4217-Mar-21 3:28
Memberchizzy4217-Mar-21 3:28 
QuestionBeginner 5 Project idea Pin
Member 1373246628-Feb-21 15:29
MemberMember 1373246628-Feb-21 15:29 
AnswerRe: Beginner 5 Project idea Pin
Richard MacCutchan28-Feb-21 22:37
mveRichard MacCutchan28-Feb-21 22:37 
AnswerRe: Beginner 5 Project idea Pin
Scott Butchers19-Mar-21 4:26
MemberScott Butchers19-Mar-21 4:26 
QuestionHow to navigate to next search term in angular with up and down arrow buttons? Pin
shruti devurkar18-Feb-21 6:54
Membershruti devurkar18-Feb-21 6:54 
SuggestionRe: How to navigate to next search term in angular with up and down arrow buttons? Pin
CHill6018-Feb-21 6:55
mveCHill6018-Feb-21 6:55 
QuestionTrying to read a value that is coming from html() function from Table Cell Id Pin
simpledeveloper17-Feb-21 20:42
Membersimpledeveloper17-Feb-21 20:42 
AnswerRe: Trying to read a value that is coming from html() function from Table Cell Id Pin
Richard MacCutchan17-Feb-21 22:38
mveRichard MacCutchan17-Feb-21 22:38 
GeneralRe: Trying to read a value that is coming from html() function from Table Cell Id Pin
simpledeveloper17-Feb-21 22:59
Membersimpledeveloper17-Feb-21 22:59 
GeneralRe: Trying to read a value that is coming from html() function from Table Cell Id Pin
Richard MacCutchan17-Feb-21 23:45
mveRichard MacCutchan17-Feb-21 23:45 
GeneralRe: Trying to read a value that is coming from html() function from Table Cell Id Pin
simpledeveloper17-Feb-21 23:47
Membersimpledeveloper17-Feb-21 23:47 
GeneralRe: Trying to read a value that is coming from html() function from Table Cell Id Pin
Richard MacCutchan18-Feb-21 0:11
mveRichard MacCutchan18-Feb-21 0:11 
GeneralRe: Trying to read a value that is coming from html() function from Table Cell Id Pin
simpledeveloper18-Feb-21 8:08
Membersimpledeveloper18-Feb-21 8:08 

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.