Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

make this work twice

Posted on 2006-10-31
3
Medium Priority
?
348 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

610 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