?
Solved

make this work twice

Posted on 2006-10-31
3
Medium Priority
?
346 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
Suggested Courses

777 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