I have a student simulation that has 5 different dates embedded about 100 times in a text file. The dates are choreographed back in time from the date of the simulation. Each year I have to redo all the dates to match the date of the simulation before printing it out. I am trying to create a HTML file that I can open in my browser each year.

The following works, but I had to create 5 different functions, one for each date.

Is there are way to pass the a value from each <div> so the date back in time is calculated correct when the "Calculate Dates" button is pressed?

Here is what I have for 2 functions

Code:
<head>
<script type="text/javascript">
    function ActivityDate0() //calculates the dates in the text
    {
        var date = new Date();     
        var ms = 86400000 
        var mtg = document.getElementById("daystoactivity").value;
        if (mtg < 1){
            mtg = 0
            };
        var x = 0
        var daysback = x - mtg;
        var nd = date - (daysback * ms);
        nd = new Date(nd);
        var curr_day = ("0" + nd.getDate()).slice(-2);
        var curr_month = ("0" + (nd.getMonth() + 1)).slice(-2);
        var curr_year = nd.getFullYear();
        //return curr_month + "/" + curr_day + "/" + curr_year;
        var newdate = curr_month + "/" + curr_day + "/" + curr_year;
        document.getElementById('t').innerHTML = newdate
        }
</script>
<script type="text/javascript">
    function ActivityDate1() //calculates the dates in the text
    {
        var date = new Date();     
        var ms = 86400000 
        var mtg = document.getElementById("daystoactivity").value;
        if (mtg < 1){
            mtg = 0
            };
        var x = 1
        var daysback = x - mtg;
        var nd = date - (daysback * ms);
        nd = new Date(nd);
        var curr_day = ("0" + nd.getDate()).slice(-2);
        var curr_month = ("0" + (nd.getMonth() + 1)).slice(-2);
        var curr_year = nd.getFullYear();
        var newdate = curr_month + "/" + curr_day + "/" + curr_year;
        document.getElementById('t1').innerHTML = newdate
        }
</script>

<script>
    function CalcDate()
    {
        GetDaysToActivity()
        ActivityDate0()
        ActivityDate1()
        ActivityDate30()
    }
</script>

</head>

<body>

<div><form name="printchart">
<label>Future date of activity (mm/dd/yyyy): &nbsp;</label>
    <input type="text" id="activitydate"name="activitydate" />
    <script>document.printchart.activitydate.focus();</script>
    <!--<input type="hidden" id="daystoactivity" name="daystoactivity" style="display: none;" />-->
    <input type="text" id="daystoactivity" name="daystoactivity" /> 
    <button onclick="CalcDate()">Calculate Dates</button>
    &nbsp;
    <input type="button" value="Print Chart" onclick="" />    
    </div>
    <br />
    <br />
<!-- the following <div>'s are located throughout the HTML -->

  <div id="t">Today</div><br />
  <div id="t1">Yesterday</div><br />
  
</div>
</body>
</html>