By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 2,334 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

popup calendar

P: n/a

Hi all,

New to developing in VS 2005 ASP 2.0

Trying to have a easy pop calender for a button on a web page.

I keep getting a error message in IE6 that says:
Line 69
Char 3
Error: 'this.container' is null or not an object

In red I put an arrow at line 69 in the js file

I'm using Nick Baicoianu code that I got off the web.

I've in closed the code with *** where I have put the function to reference
js file?

this is how i'm using it:

In a js file I have this:

/************************************************** ***************************
Copyright (C) 2006 Nick Baicoianu

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
************************************************** ***************************/
//constructor for the main Epoch class (ENGLISH VERSION)
function Epoch(name,mode,targetelement,multiselect)
this.state = 0; = name;
this.curDate = new Date();
this.mode = mode;
this.selectMultiple = (multiselect == true); //'false' is not true or not
set at all

//the various calendar variables
//this.selectedDate = this.curDate;
this.selectedDates = new Array();
this.cells = new Array();

//The controls

//standard initializations
this.mousein = false;
this.displayYear = this.displayYearInitial;
this.displayMonth = this.displayMonthInitial;

this.createCalendar(); //create the calendar DOM element and its children,
and their related objects

if(this.mode == 'popup' && targetelement && targetelement.type == 'text')
//if the target element has been set to be an input text box
this.tgt = targetelement; = 'absolute';
this.topOffset = this.tgt.offsetHeight; // the vertical distance (in
pixels) to display the calendar from the Top of its input element
this.leftOffset = 0; // the horizontal distance (in pixels) to
display the calendar from the Left of its input element = this.getTop(targetelement) + this.topOffset +
'px'; = this.getLeft(targetelement) + this.leftOffset +
this.tgt.calendar = this;
this.tgt.onfocus = function () {;}; //the calendar
will popup when the input element is focused
this.tgt.onblur = function ()
{if(!this.calendar.mousein){this.calendar.hide();} }; //the calendar will
popup when the input element is focused
this.container = targetelement;
this is line 69 -->> }

this.state = 2; //0: initializing, 1: redrawing, 2: finished!
this.visible ? : this.hide();


In another js file I have this:

// JScript File
var bas_cal, dp_cal, ms_cal; /*must be declared in global scope*/
/*put the calendar initializations in the window's onload() method*/
window.onload = function() {
bas_cal = new
Epoch('epoch_basic','flat',document.getElementById ('basic_container'));
ms_cal = new
Epoch('epoch_multi','flat',document.getElementById ('multi_container'),true);
dp_cal = new
Epoch('epoch_popup','popup',document.getElementByI d('popup_container'));
and in my master page I have this:

<%@ Master Language="VB" CodeFile="MainMasterPage.master.vb"
Inherits="MainMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" >
<head runat="server">
<link rel="stylesheet" type="text/css" href="javascript/epoch_styles.css"
/> <!--Epoch's styles-->
<script type="text/javascript" src="javascript/epoch_classes.js"></script>
<!--Epoch's Code-->
<script type="text/javascript"
src="javascript/my_declarations.js"></script> <!--Epoch Declarations-->

<form id="form1" runat="server">
<div style="background-color: #6f9a64">
<table border="0" cellpadding="0" cellspacing="0" style="width:
100%; height: 100%" id="MainTable" runat="server">
<td colspan="2" style="height: 87px; background-image:
url(images/maingrad2.JPG); border-bottom-color: #006600;">

<img id="imageheader"
style="z-index: 100; left: 53px; width: 101px; position:
absolute; top: 25px;
height: 66px; -moz-opacity:70%;
filter:alpha(opacity=75); opacity:0.75"
alt="Helicoverpa Armigera"
<div style="z-index: 101; left: 336px; width: 246px;
color: black; position: absolute;
top: 78px; height: 24px">
<span id="ctl00_Label1" style="font-weight: bold;
font-size: 1.4em; color: #404040;
font-family: Arial">PPQ Eastern Region</span>
<asp:SiteMapDataSource ID="SiteMapDataSource1"
runat="server" ShowStartingNode="False" />

<td colspan="3" style="border-right: #003300 thin solid;
border-top: #999999 thin solid;
font-weight: bold; font-size: 12px; border-bottom-color:
#006600; color: gray;
height: 9px; background-color: #aec7a9; text-align: left
" id="Celldate">
<asp:Label ID="datelbl" runat="server"
<asp:Label ID="hostlbl" runat="server" Width="40%"


<td style="width: 157px; vertical-align: top; border-right:
#003300 thin solid; background-color: #ffffff; text-align: left; border-top:
#003300 thin solid; border-left: #003300 thin solid; position: relative;
height: 78%;">

<asp:Menu ID="Menu1" runat="server"
DataSourceID="SiteMapDataSource1" Width="100%" Height="90px"
style="font-weight: normal; font-size: large; font-family: Verdana;
background-color: white; padding-left:
5px; border-top-style: none;
border-right-style: none; border-left-style: none; border-bottom-style: none;
width: 100%;" Font-Names="Verdana" ForeColor="#404040" Font-Bold="True"
Font-Size="Medium" BorderColor="Black" BorderStyle="Solid">
<StaticHoverStyle BackColor="#A1BC99"
BorderColor="White" ForeColor="#404040" />

************************************************** ***
<input id="popup_container" type="text" />
<input type="button" value="pick" onclick="dp_cal.toggle();" />

************************************************** **
<td style="background-color: #ffffff; vertical-align: top;
font-size: large; border-left-color: #006600; color: black; font-family:
Arial; table-layout: fixed; border-top: #003300 thin solid; height: 78%;
width: 618px; position: static;">
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
<br />
<br />

<br />
<td colspan="2">


Jun 19 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.