i want to add input value to the var whos equal to the first input valueHow can I add a key/value pair to a JavaScript object?Creating a simple JQuery tooltip?String Time Validations (In javascript)Set the value of an input fieldHow to determine if Javascript array contains an object with an attribute that equals a given value?How do I get the value of text input field using JavaScript?Calculating time diference in JavaScript (days+hours+minutes+seconds)Javascript to validate hours per week/weeks per year enteredDetermining if day or night after calculating sunset and sunrise timesInput box validation when there is no input

Which one is correct as adjective “protruding” or “protruded”?

Is this toilet slogan correct usage of the English language?

Has any country ever had 2 former presidents in jail simultaneously?

What should you do when eye contact makes your subordinate uncomfortable?

It grows, but water kills it

Why did the EU agree to delay the Brexit deadline?

How can "mimic phobia" be cured or prevented?

Problem with TransformedDistribution

How to bake one texture for one mesh with multiple textures blender 2.8

Should I outline or discovery write my stories?

Creature in Shazam mid-credits scene?

Does a 'pending' US visa application constitute a denial?

Where does the bonus feat in the cleric starting package come from?

Closed-form expression for certain product

How do I color the graph in datavisualization?

Drawing ramified coverings with tikz

I am looking for the correct translation of love for the phrase "in this sign love"

Why does the Sun have different day lengths, but not the gas giants?

Strong empirical falsification of quantum mechanics based on vacuum energy density

Biological Blimps: Propulsion

Pre-mixing cryogenic fuels and using only one fuel tank

What is this called? Old film camera viewer?

What are the purposes of autoencoders?

Is the U.S. Code copyrighted by the Government?



i want to add input value to the var whos equal to the first input value


How can I add a key/value pair to a JavaScript object?Creating a simple JQuery tooltip?String Time Validations (In javascript)Set the value of an input fieldHow to determine if Javascript array contains an object with an attribute that equals a given value?How do I get the value of text input field using JavaScript?Calculating time diference in JavaScript (days+hours+minutes+seconds)Javascript to validate hours per week/weeks per year enteredDetermining if day or night after calculating sunset and sunrise timesInput box validation when there is no input













0


















function onbtntime(sec) 
var hours;
var minutes;
var day;
var sec;

if (isNaN(sec))
alert("please enter a number");
sec = 0;

if (Number(sec) <= 0)
alert("Please enter a positive number");
sec = 0;
else if (sec == undefined)
sec = 0;
else if (sec >= 60)

minutes = Math.floor(sec / 60);
sec = Math.round(sec % 60);
if (minutes >= 60)
hours = Math.floor(minutes / 60);
minutes = Math.round(minutes % 60);
if (hours >= 24)
day = Math.floor(hours / 24);
hours = Math.round(hours % 24);




if (hours == undefined)
hours = 0;

if (minutes == undefined)
minutes = 0;

if (day == undefined)
day = 0;

id_p.innerHTML = "Time- " + "Day/s: " + day + " ,hours: " + hours + " ,minutes: " + minutes + " ,sec: " +
sec;

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h2>Welcome to my Time calculator </h2>
<p id="id_p">Change Second to day/s, hours and minutes.</p>
<label>Enter your sec</label>
<input type="text" id="id_input" />
<button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
</body>
</html>





this is my code i want that when the user add one or thousand inputs value after the first one they calculate and out the correct time. mmm for example i just want that after i send the input value 500 the output be:
(Time- Day/s: 0 ,Hours: 0 ,minutes: 8 ,sec: 20)
and if send the input value 500 the output be:
(Time- Day/s: 0 ,Hours: 0 ,minutes: 16 ,sec: 40)
and so on...
sorry for my bad English
Thanks for help










share|improve this question









New contributor




CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    0


















    function onbtntime(sec) 
    var hours;
    var minutes;
    var day;
    var sec;

    if (isNaN(sec))
    alert("please enter a number");
    sec = 0;

    if (Number(sec) <= 0)
    alert("Please enter a positive number");
    sec = 0;
    else if (sec == undefined)
    sec = 0;
    else if (sec >= 60)

    minutes = Math.floor(sec / 60);
    sec = Math.round(sec % 60);
    if (minutes >= 60)
    hours = Math.floor(minutes / 60);
    minutes = Math.round(minutes % 60);
    if (hours >= 24)
    day = Math.floor(hours / 24);
    hours = Math.round(hours % 24);




    if (hours == undefined)
    hours = 0;

    if (minutes == undefined)
    minutes = 0;

    if (day == undefined)
    day = 0;

    id_p.innerHTML = "Time- " + "Day/s: " + day + " ,hours: " + hours + " ,minutes: " + minutes + " ,sec: " +
    sec;

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    </head>
    <body>
    <h2>Welcome to my Time calculator </h2>
    <p id="id_p">Change Second to day/s, hours and minutes.</p>
    <label>Enter your sec</label>
    <input type="text" id="id_input" />
    <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
    </body>
    </html>





    this is my code i want that when the user add one or thousand inputs value after the first one they calculate and out the correct time. mmm for example i just want that after i send the input value 500 the output be:
    (Time- Day/s: 0 ,Hours: 0 ,minutes: 8 ,sec: 20)
    and if send the input value 500 the output be:
    (Time- Day/s: 0 ,Hours: 0 ,minutes: 16 ,sec: 40)
    and so on...
    sorry for my bad English
    Thanks for help










    share|improve this question









    New contributor




    CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0











      function onbtntime(sec) 
      var hours;
      var minutes;
      var day;
      var sec;

      if (isNaN(sec))
      alert("please enter a number");
      sec = 0;

      if (Number(sec) <= 0)
      alert("Please enter a positive number");
      sec = 0;
      else if (sec == undefined)
      sec = 0;
      else if (sec >= 60)

      minutes = Math.floor(sec / 60);
      sec = Math.round(sec % 60);
      if (minutes >= 60)
      hours = Math.floor(minutes / 60);
      minutes = Math.round(minutes % 60);
      if (hours >= 24)
      day = Math.floor(hours / 24);
      hours = Math.round(hours % 24);




      if (hours == undefined)
      hours = 0;

      if (minutes == undefined)
      minutes = 0;

      if (day == undefined)
      day = 0;

      id_p.innerHTML = "Time- " + "Day/s: " + day + " ,hours: " + hours + " ,minutes: " + minutes + " ,sec: " +
      sec;

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      </head>
      <body>
      <h2>Welcome to my Time calculator </h2>
      <p id="id_p">Change Second to day/s, hours and minutes.</p>
      <label>Enter your sec</label>
      <input type="text" id="id_input" />
      <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
      </body>
      </html>





      this is my code i want that when the user add one or thousand inputs value after the first one they calculate and out the correct time. mmm for example i just want that after i send the input value 500 the output be:
      (Time- Day/s: 0 ,Hours: 0 ,minutes: 8 ,sec: 20)
      and if send the input value 500 the output be:
      (Time- Day/s: 0 ,Hours: 0 ,minutes: 16 ,sec: 40)
      and so on...
      sorry for my bad English
      Thanks for help










      share|improve this question









      New contributor




      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.















      function onbtntime(sec) 
      var hours;
      var minutes;
      var day;
      var sec;

      if (isNaN(sec))
      alert("please enter a number");
      sec = 0;

      if (Number(sec) <= 0)
      alert("Please enter a positive number");
      sec = 0;
      else if (sec == undefined)
      sec = 0;
      else if (sec >= 60)

      minutes = Math.floor(sec / 60);
      sec = Math.round(sec % 60);
      if (minutes >= 60)
      hours = Math.floor(minutes / 60);
      minutes = Math.round(minutes % 60);
      if (hours >= 24)
      day = Math.floor(hours / 24);
      hours = Math.round(hours % 24);




      if (hours == undefined)
      hours = 0;

      if (minutes == undefined)
      minutes = 0;

      if (day == undefined)
      day = 0;

      id_p.innerHTML = "Time- " + "Day/s: " + day + " ,hours: " + hours + " ,minutes: " + minutes + " ,sec: " +
      sec;

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      </head>
      <body>
      <h2>Welcome to my Time calculator </h2>
      <p id="id_p">Change Second to day/s, hours and minutes.</p>
      <label>Enter your sec</label>
      <input type="text" id="id_input" />
      <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
      </body>
      </html>





      this is my code i want that when the user add one or thousand inputs value after the first one they calculate and out the correct time. mmm for example i just want that after i send the input value 500 the output be:
      (Time- Day/s: 0 ,Hours: 0 ,minutes: 8 ,sec: 20)
      and if send the input value 500 the output be:
      (Time- Day/s: 0 ,Hours: 0 ,minutes: 16 ,sec: 40)
      and so on...
      sorry for my bad English
      Thanks for help






      function onbtntime(sec) 
      var hours;
      var minutes;
      var day;
      var sec;

      if (isNaN(sec))
      alert("please enter a number");
      sec = 0;

      if (Number(sec) <= 0)
      alert("Please enter a positive number");
      sec = 0;
      else if (sec == undefined)
      sec = 0;
      else if (sec >= 60)

      minutes = Math.floor(sec / 60);
      sec = Math.round(sec % 60);
      if (minutes >= 60)
      hours = Math.floor(minutes / 60);
      minutes = Math.round(minutes % 60);
      if (hours >= 24)
      day = Math.floor(hours / 24);
      hours = Math.round(hours % 24);




      if (hours == undefined)
      hours = 0;

      if (minutes == undefined)
      minutes = 0;

      if (day == undefined)
      day = 0;

      id_p.innerHTML = "Time- " + "Day/s: " + day + " ,hours: " + hours + " ,minutes: " + minutes + " ,sec: " +
      sec;

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      </head>
      <body>
      <h2>Welcome to my Time calculator </h2>
      <p id="id_p">Change Second to day/s, hours and minutes.</p>
      <label>Enter your sec</label>
      <input type="text" id="id_input" />
      <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
      </body>
      </html>





      function onbtntime(sec) 
      var hours;
      var minutes;
      var day;
      var sec;

      if (isNaN(sec))
      alert("please enter a number");
      sec = 0;

      if (Number(sec) <= 0)
      alert("Please enter a positive number");
      sec = 0;
      else if (sec == undefined)
      sec = 0;
      else if (sec >= 60)

      minutes = Math.floor(sec / 60);
      sec = Math.round(sec % 60);
      if (minutes >= 60)
      hours = Math.floor(minutes / 60);
      minutes = Math.round(minutes % 60);
      if (hours >= 24)
      day = Math.floor(hours / 24);
      hours = Math.round(hours % 24);




      if (hours == undefined)
      hours = 0;

      if (minutes == undefined)
      minutes = 0;

      if (day == undefined)
      day = 0;

      id_p.innerHTML = "Time- " + "Day/s: " + day + " ,hours: " + hours + " ,minutes: " + minutes + " ,sec: " +
      sec;

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      </head>
      <body>
      <h2>Welcome to my Time calculator </h2>
      <p id="id_p">Change Second to day/s, hours and minutes.</p>
      <label>Enter your sec</label>
      <input type="text" id="id_input" />
      <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
      </body>
      </html>






      javascript






      share|improve this question









      New contributor




      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 50 mins ago









      Ucho

      482417




      482417






      New contributor




      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Mar 20 at 15:34









      CrhisSonOfOdinCrhisSonOfOdin

      41




      41




      New contributor




      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      CrhisSonOfOdin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          You just have to store your seconds in global variable in this case.






          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);








          share|improve this answer

























          • thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

            – CrhisSonOfOdin
            2 days ago











          • I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

            – Ucho
            2 days ago












          • Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

            – CrhisSonOfOdin
            7 hours ago











          • Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

            – Ucho
            3 hours ago


















          0














          Just add global variable for your global numbers (I made object called result) and assign it's value and new input value every time user presses button.






          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>








          share|improve this answer

























          • Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

            – CrhisSonOfOdin
            2 days ago












          • Have you figured out what you want or no?

            – Maksims Kitajevs
            2 days ago











          • Ucho did what i wanted. thank u anyway for trying to help

            – CrhisSonOfOdin
            7 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          CrhisSonOfOdin is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55264593%2fi-want-to-add-input-value-to-the-var-whos-equal-to-the-first-input-value%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You just have to store your seconds in global variable in this case.






          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);








          share|improve this answer

























          • thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

            – CrhisSonOfOdin
            2 days ago











          • I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

            – Ucho
            2 days ago












          • Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

            – CrhisSonOfOdin
            7 hours ago











          • Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

            – Ucho
            3 hours ago















          0














          You just have to store your seconds in global variable in this case.






          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);








          share|improve this answer

























          • thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

            – CrhisSonOfOdin
            2 days ago











          • I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

            – Ucho
            2 days ago












          • Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

            – CrhisSonOfOdin
            7 hours ago











          • Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

            – Ucho
            3 hours ago













          0












          0








          0







          You just have to store your seconds in global variable in this case.






          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);








          share|improve this answer















          You just have to store your seconds in global variable in this case.






          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);








          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);





          let secs = 0;

          function onbtntime(sec)

          if (!Number(sec)

          //onbtntime("u");
          //onbtntime(0);
          onbtntime(3600);
          onbtntime(86400);
          onbtntime(63);
          onbtntime(90116);
          onbtntime(3);






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered Mar 20 at 15:41









          UchoUcho

          482417




          482417












          • thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

            – CrhisSonOfOdin
            2 days ago











          • I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

            – Ucho
            2 days ago












          • Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

            – CrhisSonOfOdin
            7 hours ago











          • Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

            – Ucho
            3 hours ago

















          • thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

            – CrhisSonOfOdin
            2 days ago











          • I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

            – Ucho
            2 days ago












          • Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

            – CrhisSonOfOdin
            7 hours ago











          • Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

            – Ucho
            3 hours ago
















          thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

          – CrhisSonOfOdin
          2 days ago





          thank u your code its what i want only one problam if the user press sec smaller then 60 its not calculate how can i fix it?

          – CrhisSonOfOdin
          2 days ago













          I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

          – Ucho
          2 days ago






          I changed the code. It’s suspicious you’re not able to make such a small change. Is it your school work?

          – Ucho
          2 days ago














          Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

          – CrhisSonOfOdin
          7 hours ago





          Thank you for the help. hhhh not it just because iam stupid and lazy. nop.

          – CrhisSonOfOdin
          7 hours ago













          Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

          – Ucho
          3 hours ago





          Ok. You should mark this as answer if you’re satisfied. Also you can upvote if you find it well coded.

          – Ucho
          3 hours ago













          0














          Just add global variable for your global numbers (I made object called result) and assign it's value and new input value every time user presses button.






          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>








          share|improve this answer

























          • Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

            – CrhisSonOfOdin
            2 days ago












          • Have you figured out what you want or no?

            – Maksims Kitajevs
            2 days ago











          • Ucho did what i wanted. thank u anyway for trying to help

            – CrhisSonOfOdin
            7 hours ago
















          0














          Just add global variable for your global numbers (I made object called result) and assign it's value and new input value every time user presses button.






          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>








          share|improve this answer

























          • Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

            – CrhisSonOfOdin
            2 days ago












          • Have you figured out what you want or no?

            – Maksims Kitajevs
            2 days ago











          • Ucho did what i wanted. thank u anyway for trying to help

            – CrhisSonOfOdin
            7 hours ago














          0












          0








          0







          Just add global variable for your global numbers (I made object called result) and assign it's value and new input value every time user presses button.






          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>








          share|improve this answer















          Just add global variable for your global numbers (I made object called result) and assign it's value and new input value every time user presses button.






          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>








          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>





          var result = 
          hours: 0,
          min: 0,
          days: 0,
          sec: 0
          ;

          function onbtntime(sec)
          var hours;
          var minutes;
          var day;
          var sec;

          if (isNaN(sec))
          alert("please enter a number");
          sec = 0;

          if (Number(sec) <= 0)
          alert("Please enter a positive number");
          sec = 0;
          else if (sec == undefined)
          sec = 0;
          else if (sec >= 60)

          minutes = Math.floor(sec / 60);
          sec = Math.round(sec % 60);
          if (minutes >= 60)
          hours = Math.floor(minutes / 60);
          minutes = Math.round(minutes % 60);
          if (hours >= 24)
          day = Math.floor(hours / 24);
          hours = Math.round(hours % 24);




          if (hours == undefined)
          hours = 0;

          if (minutes == undefined)
          minutes = 0;

          if (day == undefined)
          day = 0;

          result.hours += hours;
          result.min += minutes;
          result.days += day;
          result.sec += sec;
          id_p.innerHTML = "Time- " + "Day/s: " + result.days + " ,hours: " + result.hours + " ,minutes: " + result.min + " ,sec: " +
          result.sec;

          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta http-equiv="X-UA-Compatible" content="ie=edge">
          <title>Document</title>
          </head>
          <body>
          <h2>Welcome to my Time calculator </h2>
          <p id="id_p">Change Second to day/s, hours and minutes.</p>
          <label>Enter your sec</label>
          <input type="text" id="id_input" />
          <button type="button" id="id_button" onclick="onbtntime(parseInt(id_input.value))">שלח</button>
          </body>
          </html>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 50 mins ago









          Ucho

          482417




          482417










          answered Mar 20 at 15:47









          Maksims KitajevsMaksims Kitajevs

          1355




          1355












          • Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

            – CrhisSonOfOdin
            2 days ago












          • Have you figured out what you want or no?

            – Maksims Kitajevs
            2 days ago











          • Ucho did what i wanted. thank u anyway for trying to help

            – CrhisSonOfOdin
            7 hours ago


















          • Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

            – CrhisSonOfOdin
            2 days ago












          • Have you figured out what you want or no?

            – Maksims Kitajevs
            2 days ago











          • Ucho did what i wanted. thank u anyway for trying to help

            – CrhisSonOfOdin
            7 hours ago

















          Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

          – CrhisSonOfOdin
          2 days ago






          Thank you but this is not calculate it like i want, in this code for example if i press 6000 and then again 6000 the output is (Time- Day/s: 0 ,hours: 2 ,minutes: 80 ,sec: 0) and not (Time- Day/s: 0 ,hours: 3 ,minutes: 20 ,sec: 0) like i want it

          – CrhisSonOfOdin
          2 days ago














          Have you figured out what you want or no?

          – Maksims Kitajevs
          2 days ago





          Have you figured out what you want or no?

          – Maksims Kitajevs
          2 days ago













          Ucho did what i wanted. thank u anyway for trying to help

          – CrhisSonOfOdin
          7 hours ago






          Ucho did what i wanted. thank u anyway for trying to help

          – CrhisSonOfOdin
          7 hours ago











          CrhisSonOfOdin is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          CrhisSonOfOdin is a new contributor. Be nice, and check out our Code of Conduct.












          CrhisSonOfOdin is a new contributor. Be nice, and check out our Code of Conduct.











          CrhisSonOfOdin is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55264593%2fi-want-to-add-input-value-to-the-var-whos-equal-to-the-first-input-value%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript