Solved

make this work twice

Posted on 2006-10-31
3
337 Views
Last Modified: 2010-08-05
Hi

How would it be possible please for me to get two instances of this working on one page

to see what it does go here
http://teamconsole.eu/test.php

code is here
<script src="CalendarPopup.js"></script>
<div align="center">
<SCRIPT LANGUAGE="JavaScript" ID="js10">

var cal = new CalendarPopup();

function Yesterday()
    {
      y = new Date();
      y.setHours( 12 );
      y.setTime( y.getTime() - 86400000 );
      return y;
    }
now =  Yesterday();
cal.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));
cal.setReturnFunction("setMultipleValues2");
function setMultipleValues2(y,m,d) {
      
      document.forms['example'].date_year.value=y;
      document.forms['example'].date_month.value=LZ(m);
      document.forms['example'].date_day.value=LZ(d);
      }
</SCRIPT>

   <table border="0" align="center" cellpadding="4" cellspacing="0">
                  <form name="example" method="post" action="guestlists.php">
                    <tr>
                      <td height="52" align="center" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><A HREF="#" onClick="cal.showCalendar('anchor1'); return false;" TITLE="cal.showCalendar('anchor1'); return false;" NAME="anchor1" ID="anchor1">select date<br>
                      </A></td>
                      <td><INPUT NAME="date_month" value="<?=$date_month?>" TYPE="text" SIZE=3 maxlength="2">
                        <font size="2" face="Verdana, Arial, Helvetica, sans-serif">/</font>
                        <INPUT NAME="date_day" value="<?=$date_day?>" TYPE="text" SIZE=3 maxlength="2">
                        <font size="2" face="Verdana, Arial, Helvetica, sans-serif">/</font>
                        <INPUT NAME="date_year" TYPE="text" value="<?=$date_year?>" SIZE=5 maxlength="4"><br>
                        <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Date [mm/dd/yyyy]</font></td>
                    </tr>
                 
              </table>  
0
Comment
Question by:avo42
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 500 total points
ID: 17845709
Create a cal2 instance of the calendar.

<SCRIPT LANGUAGE="JavaScript" ID="js10">

var cal = new CalendarPopup();
var cal2 = new CalendarPopup();

function Yesterday()
    {
      y = new Date();
      y.setHours( 12 );
      y.setTime( y.getTime() - 86400000 );
      return y;
    }
now =  Yesterday();
cal.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));
cal.setReturnFunction("setMultipleValues2");
cal2.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));
cal2.setReturnFunction("setMultipleValues2_new");
function setMultipleValues2(y,m,d) {
     
     document.forms['example'].date_year.value=y;
     document.forms['example'].date_month.value=LZ(m);
     document.forms['example'].date_day.value=LZ(d);
     }
function setMultipleValues2_new(y,m,d) {
     document.forms['example2'].date_year.value=y;
// or you could have the input boxes in the same form like document.forms['example'].date_year2.value=y;
     document.forms['example2'].date_month.value=LZ(m);
     document.forms['example2'].date_day.value=LZ(d);
     }
</SCRIPT>


0
 

Author Comment

by:avo42
ID: 17846005
Hi Thank you

works great appriciated

Do you know of a clock that will do the same as this but output time


thanks again.
0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 17846271
Not off hand.
This site has tons of little scripts: http://javascript.internet.com/
Other than that, I would just do a Google search for one.
Good Luck!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now