Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8461927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:01:01+00:00 2026-06-10T14:01:01+00:00

I have 2 input typ button and an input type textfield. The both button

  • 0

I have 2 input typ button and an input type textfield. The both button are there to activate a function for adding or substracting some days .

In fact all is generated by ma database from mysql.

the thing is that I have many dates because the php script does manage some calendars with some actions associated to the dates.

sometimes we needs to manage the calendar in order to give few days after the meetings.

So i’ve done that function:

in javascript:

​<script type="text/javascript">
    function addday() {
        var items = new Array();
        var itemCount = document.getElementsByClassName("date");

        for (var i = 0; i < itemCount.length; i++) {
            items[i] = document.getElementById("date" + (i + 1)).value;
        }



        for (var i = 0; i < itemCount.length; i++) {
            items[i] = document.getElementById("date" + (i + 1)).value;
            var itemDtParts = items[i].split("-");
            var itemDt = new Date(itemDtParts[2], itemDtParts[1] - 1, itemDtParts[0]);
            nb=document.getElementById('nb').value;


                itemCount[i].value = setDate(itemDt + nb) ;



        }


       return items;
           }

</script>

the concern is that this script does not work.

I can not correct the mistakes I’m trying since 2 hours and i’ve read many about dates But I don’t know how to.

first of all it says to me that setDate is not defined.

And the page is freezing.

Receive all my Utmost Respect.

SP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:01:02+00:00Added an answer on June 10, 2026 at 2:01 pm

    You have to call setDate method on javascript Date object.
    Use like this

    <script type="text/javascript">
        function addday() {
            var items = new Array();
            var itemCount = document.getElementsByClassName("date");
    
            for (var i = 0; i < itemCount.length; i++) {
                items[i] = document.getElementById("date" + (i + 1)).value;
            }
    
    
    
            for (var i = 0; i < itemCount.length; i++) {
                items[i] = document.getElementById("date" + (i + 1)).value;
                var itemDtParts = items[i].split("-");
                var itemDt = new Date(itemDtParts[2], itemDtParts[1] - 1, itemDtParts[0]);
                nb=document.getElementById('nb').value;
    
        var newDate = itemDt.getDate() + nb;
            itemDt.setDate(newDate ) ;
                    itemCount[i].value = itemDt;
    
            }
    
    
           return items;
               }
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have input with either some given or empty data-file: <input type=text value=path/to/file.gif name=some_file
I have this form: <form> <div class=box> <h1>Contact form :</h1> <label> <span>Typ: </span> <input
I have input text: <div><label wicket:for=name>Name</label><input type=text wicket:id=name /></div> Now I need to add
I have this input text and an input button...I am looking to have them
I have input string DISPLAY_MSG='Kumar + sajdhjhasd - Type' and ID=156090 and RESOURCE_KEY='Ascend.ElementMaster.kumar_type.desc' and
I have input box txtRefreshInterval which allow only integer. <td><span class=sfFormlabel>Refresh Interval</span></td> <td><input type=text
I have input checkbox something like this.. <input class=inputchbox id=Pchk type=checkbox name=check value=<%=Model.ID%> />
I have input tags with a user defined attribute as:- <input name=grp1 type=radio myUDF=value1
I have input fields with randomly-ordered ids as follows: <input type=text id=start1 /> <input
I have input <input type=hidden value=Select Value 11121 DataValue name=111 id=222/> I select value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.