javascript calendar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vinu

    javascript calendar


    I have a javascript file named select.js. This is a file which is use
    to pop up a calendar, when clicked on a calendar icon in an ASP file.
    have a close button in the calendar. When i click on the button, th
    calendar is not closing.

    here is the select.js file

    x999NS4compatib le = (document.layer s);
    var x999IE4compatib le = (document.all);
    var x999dayabbs = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];
    var x999daynames = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday'
    'Thursday', 'Friday', 'Saturday' ];
    var x999monthnames = [ 'January', 'February', 'March', 'April', 'May'
    'June', 'July', 'August', 'September', 'October', 'November'
    'December' ];
    var x999monthabbs = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'
    'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
    var x999weekdays = [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ];
    var x999months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'
    'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
    var x999years = new Array(10);
    for (i = 0; i < x999years.lengt h; i++) x999years[i] = 1999 + i;
    var x999today = new Date();
    var x999currentday = x999today.getDa te();
    var x999currentmont h = x999today.getMo nth();
    var x999currentyear = x999today.getFu llYear();
    var x999left = 100;
    var x999top = 80;
    var x999width = 220;
    var x999height = 260;
    var x999cell_width = 25;
    var x999cell_height = 25;
    var x999bg_color = '#0072a0';
    var x999offsety = 32;
    var x999fontface = "verdana";
    var x999weekcolor = "yellow";
    var x999weeksize= "2";
    var x999lowyear = 1900;
    var x999highyear = 2999;
    var x999weekfont = '<font face="' + x999fontface + '" size="'
    x999weeksize + '" color="' + x999weekcolor + '">';
    var x999font = '<font face="' + x999fontface + '" size="1">';
    + ";color:#000000 ;font-size:7pt;font-weight:bold;'";
    var x999stylecombo = "style = 'font-family:" + x999fontface
    ";color:#000000 ;font-size:7pt;font-weight:bold;'";
    var x999style = "style = 'font-family:" + x999fontface
    ";BACKGROUN D-COLOR: #004680; FONT-SIZE: xx-small; FONT-WEIGHT: bold
    HEIGHT: 22px; WIDTH: 23px ;COLOR: WHITE'";
    var x999stylebut = "style = 'font-family:" + x999fontface
    ";BACKGROUN D-COLOR: #004680; FONT-SIZE: xx-small; FONT-WEIGHT: bold
    HEIGHT: 22px; WIDTH: 43px ;COLOR: WHITE'";
    var x999headerstyle = "style = 'font-family:" + x999fontface
    ";color:#000000 ;font-size:1;font-weight:bold;'";
    var x999daystyle = "style = 'BACKGROUND-COLOR: #004680; FONT-SIZE
    xxx-small; FONT-WEIGHT: bold; HEIGHT: 20px; WIDTH: 24px ;COLOR
    WHITE;BORDER-TOP:BLUE;BORDER-LEFT:BLUE'";
    var x999tableborder = '1';
    var frm_name = '';
    var frm_fld = ''

    function x999cal(is_popu p, win
    handler,form_na me,field_name,f ield_value,left , top, height
    bg_color,width,
    cell_width, cell_height, sel_month, sel_year)
    {
    this.is_popup = is_popup;
    this.parent = null;
    this.window = null;
    if (this.is_popup)
    this.parent = win;
    else
    this.window = win;
    frm_name = form_name;
    frm_fld = field_name;
    fld_val = field_value;

    this.handler = handler;
    this.left = left;
    this.top = top;
    this.width = width || x999width;
    this.height = height || x999height;
    this.cell_width = cell_width || x999cell_width;
    this.cell_heigh t = cell_height || x999cell_height ;
    this.bg_color = bg_color || x999bg_color;
    this.sel_month = sel_month;
    this.sel_year = sel_year;

    if((fld_val) != "")
    {
    if (fld_val.length > 10 || fld_val.length < 8)
    {
    alert("Invalid date");
    return false;
    exit();
    }

    a=fld_val.split ("/");

    mon = a[0];
    dat = a[1];
    yr = a[2];

    if (yr == 0000)
    {
    alert("This is an invalid year");
    return false;
    exit();
    }

    else if (mon == null || dat == null || yr == null || mon.length > 2 |
    dat.length > 2 || yr.length !=4)
    {
    alert("The date format has to be mm/dd/yyyy");
    return false;
    exit();
    }

    else if (isNaN(mon) == 1 || isNaN(dat) == 1 || isNaN(yr) == 1)
    {
    alert("Invalid date : No text form date allowed, only numeric forma
    to be entered");
    return false;
    exit();
    }

    else if (mon < 1 || mon > 12)
    {
    alert("Invalid Date : The date format should be mm/dd/yyyy , mont
    has to be between 1 and 12")
    return false;
    exit();
    }

    else if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 ||
    mon == 10 || mon == 12)
    {
    if (dat < 1 || dat > 31)
    {
    alert("Invalid Date : The date format should be mm/dd/yyyy , the
    date value you have entered is not a valid date for this month")
    return false;
    exit();
    }
    }

    else if(mon == 4 || mon == 6 || mon == 9 || mon == 11)
    {
    if(dat < 1 || dat > 31)
    {
    alert("Invalid Date : The date format should be mm/dd/yyyy , the
    date value you have entered is not a valid date for this month")
    return false;
    exit();
    }
    }

    else if (mon == 2)
    {
    if (yr%4 == 0)
    {
    if(yr%100 != 0 || yr%400 == 0)
    {
    if (dat < 1 || dat > 29)
    {
    alert("Invalid Date : The date format should be mm/dd/yyyy , the
    date value you have entered is not a valid date for this month")
    return false;
    exit();
    }
    }
    }
    else if (dat < 1 || dat > 28)
    {
    alert( "Invalid Date : The date format should be mm/dd/yyyy , the
    date value you have entered is not a valid date for this month");
    return false;
    exit();
    }
    }
    this.sel_year = yr;
    this.sel_month = mon-1;
    }
    else
    {
    this.sel_year = x999currentyear ;
    this.sel_month = x999currentmont h;
    }


    this.days = new Array(42);
    this.cal = null;
    this.day_table = null;

    if (x999NS4compati ble)
    {
    x999cal.prototy pe.create_cal = x999cal_create_ cal_NS4;
    x999cal.prototy pe.show_days = x999cal_show_da ys_NS4();
    }
    else
    {
    x999cal.prototy pe.create_cal = x999cal_create_ cal_IE4;
    x999cal.prototy pe.show_days = x999cal_show_da ys_IE4;
    }
    x999cal.prototy pe.popup_cal = x999cal_popup_c al;
    x999cal.prototy pe.prev_year = x999cal_prev_ye ar;
    x999cal.prototy pe.next_year = x999cal_next_ye ar;
    x999cal.prototy pe.new_year = x999cal_new_yea r;
    x999cal.prototy pe.prev_month = x999cal_prev_mo nth;
    x999cal.prototy pe.next_month =
    x999cal_next_mo nth;x999cal.pro totype.clicked_ day =
    x999cal_clicked _day;
    if (x999cal.protot ype.id == null) x999cal.prototy pe.id = 0;
    x999cal.prototy pe.id++;
    this.id = x999cal.prototy pe.id;
    this.cal_id = 'cal' + this.id;
    this.day_table_ id = 'day_table' + this.id;
    this.select_for m_id = 'select_form' + this.id;
    }
    function x999cal_create_ cal_NS4()
    {
    if (this.is_popup)
    {
    var x = this.parent.scr eenX + (this.parent.ou terWidth -
    this.parent.inn erWidth) + (this.left || x999left);
    var y = this.parent.scr eenY + (this.parent.ou terHeight -
    this.parent.inn erHeight) + (this.top || x999top);
    this.window = this.parent.ope n("", this.cal_id, 'screenX=' + x +
    ',screenY=' + y + ',innerWidth=' + this.width + ',innerHeight=' +
    this.height + ',scrollbars=no ,resizeable=no' );
    this.window.doc ument.open(); //Need to open and close document in
    Navigator
    this.window.doc ument.writeln(' <title>CCC STS Calendar</title>');
    this.window.doc ument.close();
    }

    this.cal = new Layer(this.widt h, this.window);
    this.cal.name = this.cal_id;
    if (this.is_popup)
    {
    this.cal.left = 0;
    this.cal.top = 0;
    }
    else
    {
    this.cal.left = this.left || x999left;
    this.cal.top = this.top || x999top;
    }

    this.cal.zIndex = 1;
    this.cal.clip.w idth = this.width;
    this.cal.clip.h eight = this.height;
    this.cal.bgColo r = this.bg_color;
    this.cal.visibi lity = 'show';
    var doc = this.cal.docume nt;
    var x999today = new Date();
    var vYear = x999today.getFu llYear();

    doc.picker = this;
    doc.open();
    doc.writeln("<c enter>");
    doc.writeln("<t able align='center' border='0' cellpadding='0' >");
    doc.writeln(" <tr>");
    doc.writeln(" <td align='center'> ");
    doc.writeln(" <form name='" + this.select_for m_id + "'>" +
    x999font);
    doc.writeln(" <input type='button' value='&lt;&lt; '
    onClick='docume nt.picker.prev_ year()' " + x999style + ">");
    doc.writeln(" <input type='button' value='&nbsp;&l t;&nbsp;'
    onClick='docume nt.picker.prev_ month()' " + x999style + ">");
    doc.writeln(" <select name='month_sel '
    onChange='docum ent.picker.new_ year()' " + x999style + " >");
    for (i = 0; i < x999months.leng th; i++)
    doc.writeln(" <option value='" + i + "'>" + x999months[i]);
    doc.writeln(" </select></font>");
    doc.writeln(" " + x999font + " <input type = 'text' value = '"
    + vYear + "' size = '4' maxlength = '4' name = 'year_sel' " +
    x999headerstyle + " onBlur='documen t.picker.new_ye ar()'>\n");
    doc.writeln(" <input type='button' value='&nbsp;&g t;&nbsp;'
    onClick='docume nt.picker.next_ month()' " + x999style + ">");
    doc.writeln(" <input type='button' value='&gt;&gt; '
    onClick='docume nt.picker.next_ year()' " + x999style + ">");
    doc.writeln(" </form>");
    doc.writeln(" </td>");
    doc.writeln(" </tr>");
    doc.writeln("</table>");
    doc.writeln("</center>");
    doc.close();
    this.day_table = new Layer(this.widt h, this.cal);
    this.day_table. name = this.day_table_ id;
    this.day_table. left = 0;
    this.day_table. top = x999offsety;
    this.day_table. zIndex = 2;
    this.day_table. visibility = 'inherit';

    }

    function x999cal_show_da ys_NS4()
    {

    var month_select =
    this.cal.docume nt.forms[this.select_for m_id]['month_sel'];
    var year_select =
    this.cal.docume nt.forms[this.select_for m_id]['year_sel'];
    month_select.se lectedIndex = this.sel_month;
    year_select.val ue = this.sel_year;
    var days_in_month = get_days_in_mon th(this.sel_mon th,
    this.sel_year);
    var day_of_week_fir st = (new Date(this.sel_y ear, this.sel_month,
    1)).getDay() - 0;
    if (day_of_week_fi rst< 1) day_of_week_fir st += 7;
    for (i = 0; i < this.days.lengt h; i++) this.days[i] = 0;
    for (i = 0; i < days_in_month; i++)
    this.days[i + day_of_week_fir st] = i + 1;
    var doc = this.day_table. document;
    doc.picker = this;
    doc.open();
    doc.writeln("<c enter>");
    doc.writeln("<t able align='center' border='" + x999tableborder
    "'>");
    doc.writeln("<f orm>");
    doc.writeln(" <tr>");
    for (j = 0; j < x999weekdays.le ngth; j++)
    {
    doc.writeln(" <td align='center' valign='middle' width='"
    this.cell_width + "' >" + x999weekfont + x999weekdays[j] + "</td>");
    }
    doc.writeln(" </tr>");
    for (i = 0; i < 6; i++)
    {
    doc.writeln(" <tr>");
    for(j = 0; j < 7; j++)
    {
    var val = this.days[i * 7 + j];
    if (val > 0 && val < 10) val = " " + val + " ";
    if (this.days[i * 7 + j])
    {
    doc.writeln(" <td align='center' valign='middle' height='"
    this.cell_heigh t + "'>" + x999font + "<input type='button' value='"
    val + "' onClick='docume nt.picker.click ed_day(" + this.days[i * 7 + j
    + ")'></td>");
    }
    else
    doc.writeln(" <td>&nbsp;</td>");
    }
    doc.writeln(" </tr>");
    }
    doc.writeln("<i nput type='button' value='Close' onClick='' "
    x999stylebut + ">");
    doc.writeln("</form>");
    doc.writeln("</table>");
    doc.writeln("</center>");
    doc.close();
    }
    function x999cal_create_ cal_IE4()
    {
    if (this.is_popup)
    {
    var x = this.parent.scr eenLeft + (this.left || x999left);
    var y = this.parent.scr eenTop + (this.top || x999top);
    this.window = this.parent.ope n("", this.cal_id, 'left=' + x
    ',top=' + y + ',width=' + this.width + ',height=' + this.height
    ',scrollbars=no ,resizeable=no' );
    this.window.doc ument.open();
    this.window.doc ument.writeln(' <title>CCC STS Calendar</title>');
    this.window.doc ument.close();
    }

    this.window.doc ument.body.inse rtAdjacentHTML( "beforeEnd" , "<div id='
    + this.cal_id + "' style='position :absolute'></div>");
    this.cal = this.window.doc ument.all[this.cal_id];
    if (this.is_popup)
    {
    this.cal.style. pixelLeft = 0;
    this.cal.style. pixelTop = 0;
    }
    else
    {
    this.cal.style. pixelLeft = this.left || x999left;
    this.cal.style. pixelTop = this.top || x999top;
    }
    this.cal.style. zIndex = 1;
    this.cal.style. width = this.width;
    this.cal.style. height = this.height;
    this.cal.style. backgroundColor = this.bg_color;
    this.cal.style. visibility = 'visible';
    this.cal.picker = this;
    var x999today = new Date();
    var vYear = x999today.getFu llYear();
    var str =
    "<center>\n " +
    "<table align='center' border='0' cellpadding='0
    cellspacing='0' ><tr><td><tab le align='center' border='0'>\n" +
    " <form name='" + this.select_for m_id + "'>\n" +
    " <tr>\n" +
    " <td align='center'> \n" +
    " <input type='button' " + x999style + " value='&lt;&lt;
    onClick='docume nt.all." + this.cal_id + ".picker.prev_y ear()'>\n" +
    " <input type='button' " + x999style + " value='&lt;&nbs p;
    onClick='docume nt.all." + this.cal_id + ".picker.prev_m onth()'>\n" +
    " <select name='month_sel ' " + x999stylecombo + "
    onChange='docum ent.all." + this.cal_id + ".picker.new_ye ar()'>\n";
    for (i = 0; i < x999months.leng th; i++)
    str += " <option value='" + i + "'>" + x999months[i] + "\n";
    str += " </select>\n" +
    " <input type = 'text' value = '" + vYear + "' size = '4
    maxlength = '4' name = 'year_sel' " + x999stylecombo +
    onBlur='documen t.all." + this.cal_id + ".picker.new_ye ar()'>\n" +
    " <input type='button' " + x999style + " value='&gt;&nbs p;
    onClick='docume nt.all." + this.cal_id + ".picker.next_m onth()'>\n" +
    " <input type='button' " + x999style + " value='&gt;&gt;
    onClick='docume nt.all." + this.cal_id + ".picker.next_y ear()'>\n" +
    " </td>\n" +
    " </tr>\n" +
    " </form>\n" +
    "</table>\n" +
    "</center>\n" +
    "<div id='" + this.day_table_ id + "
    style='position :absolute'></div>\n";this.ca l.innerHTML = str;
    this.day_table = this.window.doc ument.all[this.day_table_ id];
    this.day_table. style.pixelLeft = 4;
    this.day_table. style.pixelTop = x999offsety;
    this.day_table. style.zIndex = 2;
    this.day_table. style.visibilit y = 'inherit';
    this.day_table. picker = this;

    }

    function y2k(number)
    {
    return (number < 1000) ? number + 1900 : number;
    }

    function getWeek(year,mo nth,day)
    {
    var when = new Date(year,month ,day);
    var newYear = new Date(year,0,1);
    var offset = 7 + 1 - newYear.getDay( );
    if (offset == 8) offset = 1;
    var daynum =
    ((Date.UTC(y2k( year),when.getM onth(),when.get Date(),0,0,0) -
    Date.UTC(y2k(ye ar),0,1,0,0,0)) /1000/60/60/24) + 1;
    var weeknum = Math.floor((day num-offset+7)/7);
    if (month == 0 && weeknum > 7) weeknum = 0;
    if (offset != 1) weeknum = weeknum + 1;
    if (weeknum == 0) {
    year--;
    var prevNewYear = new Date(year,0,1);
    var prevOffset = 7 + 1 - prevNewYear.get Day();
    if (prevOffset == 2 || prevOffset == 8) weeknum = 53; else
    weeknum = 52;
    }
    return weeknum;
    }

    function x999cal_show_da ys_IE4()
    {
    var month_select =
    this.window.doc ument.forms[this.select_for m_id]['month_sel'];
    var year_select =
    this.window.doc ument.forms[this.select_for m_id]['year_sel'];
    month_select.se lectedIndex = this.sel_month;
    year_select.val ue = this.sel_year;
    var days_in_month = (new Date(this.sel_y ear, this.sel_month+ 1,
    0)).getDate();
    var day_of_week_fir st = (new Date(this.sel_y ear, this.sel_month,
    1)).getDay() - 0;
    if (day_of_week_fi rst< 0 ) day_of_week_fir st += 7;
    for (i = 0; i < this.days.lengt h; i++) this.days[i] = 0;
    for (i = 0; i < days_in_month; i++)
    this.days[i + day_of_week_fir st] = i + 1;
    var str =
    "<center>\n " +
    "&nbsp;&nbsp;<t able align='center' border='" + x999tableborder +
    "'>\n" +
    "<form>\n" +
    " <tr>\n";
    for (j = 0; j < x999weekdays.le ngth; j++)
    {
    str += " <td align='center' valign='middle' width='" +
    this.cell_width + "'>" + x999weekfont + x999weekdays[j] + "</td>\n";
    }
    str += " </tr>\n";
    for (i = 0; i < 6; i++)
    {
    str += " <tr>\n";
    for(j = 0; j < 7; j++)
    {
    var val = this.days[i * 7 + j];
    if (val > 0 && val < 10) val = " " + val + " ";
    if (this.days[i * 7 + j])
    {
    str += " <td align='center' valign='middle' height='" +
    this.cell_heigh t + "'>" + x999font + "<input type='button' " +
    x999daystyle + " value='" + val + "' onClick='docume nt.all." +
    this.day_table_ id + ".picker.clicke d_day(" + this.days[i * 7 + j] +
    ")'></td>\n";
    }
    else
    str += " <td>&nbsp;</td>\n";
    }

    str += " </tr>\n";
    }
    str +=
    "</form>\n" +
    "</table>\n" +
    "</center>\n" +
    "<input type='button' value='Close' onClick='x999ca l_clicked_day(1 )'"
    + x999stylebut + ">";

    this.day_table. innerHTML = str;
    }

    function funclose_button ()
    {

    var dt1 = eval("document. "+frm_name+"."+ frm_fld);
    var x999today = new Date();
    var x999currentday = x999today.getDa te();
    var x999currentmont h = x999today.getMo nth();
    var x999currentyear = x999today.getFu llYear();
    dt1.value = x999currentday + '/' + x999currentmont h+1 + '/' +
    x999currentyear ;
    }
    function x999cal_popup_c al()
    {
    if (this.is_popup)
    {
    if (this.cal && this.window && !this.window.cl osed)
    this.window.clo se();
    else
    {
    this.create_cal ();
    this.show_days( );
    }
    }
    else
    {
    if (!this.cal)
    {
    this.create_cal ();
    this.show_days( );
    }
    else
    {
    if (x999NS4compati ble)
    {
    if (this.cal.visib ility == 'show')
    this.cal.visibi lity = 'hide';
    else
    this.cal.visibi lity = 'show';
    }
    else
    {
    if (this.cal.style .visibility == 'visible')
    this.cal.style. visibility = 'hidden';
    else
    this.cal.style. visibility = 'visible';
    }
    }
    }

    }

    function x999cal_new_yea r()
    {

    var month_select =
    this.cal.docume nt.forms[this.select_for m_id]['month_sel'];
    this.sel_month = new
    Number(month_se lect.options[month_select.se lectedIndex].value);
    var year_select =
    this.cal.docume nt.forms[this.select_for m_id]['year_sel'];
    this.sel_year = new Number(year_sel ect.value);
    if ( (isNaN(parseInt (this.sel_year) )) || (this.sel_year < x999lowyear)
    || (this.sel_year > x999highyear) )
    {

    window.alert('T his is not a valid year.');
    var x999today = new Date;
    var yr = x999today.getFu llYear();
    this.sel_year = yr;
    }
    this.show_days( );
    function");

    }

    function x999cal_clicked _day(day)
    {

    day = 5;
    alert(day);

    if (this.is_popup)
    this.window.clo se();
    if (x999NS4compati ble)
    this.cal.visibi lity = 'hide';
    else
    this.cal.style. visibility = 'hidden';
    var sel_date = new Date(this.sel_y ear, this.sel_month, day);
    if (this.handler) this.handler(th is, sel_date);

    }

    function twodigit(num)
    {

    var numStr = num + '';
    if (numStr.length == 1)
    {
    numStr = "0" + numStr;
    }

    return numStr;

    }

    function righttwodigits( num)
    {var numStr = num + '';
    if (numStr.length == 4) {
    numStr = numStr.substrin g(1,3);}

    return numStr;
    }

    function get_days_in_mon th(mon, yr)
    {

    var month = new Number(mon);
    var year = new Number(yr);
    var mdays = [ [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
    [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ];
    var isleap =
    (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0;
    return mdays[isleap][month];}
    function my_date_selecte d(cal, date)
    {
    var dt = eval("document. "+frm_name+"."+ frm_fld);
    dt.value = twodigit(date.g etMonth() + 1) + '/' +
    twodigit(date.g etDate()) + '/' + date.getFullYea r();
    }
    if i include window.close( for the close button, the whole parent
    window is only closing. I want to close only the calendar.


    vinu
    ------------------------------------------------------------------------
    Posted via http://www.forum4designers.com
    ------------------------------------------------------------------------
    View this thread: http://www.forum4designers.com/message34935.html

  • McKirahan

    #2
    Re: javascript calendar

    "vinu" <vinu.10c3wn@ma il.forum4design ers.com> wrote in message
    news:vinu.10c3w n@mail.forum4de signers.com...[color=blue]
    >
    > I have a javascript file named select.js. This is a file which is used
    > to pop up a calendar, when clicked on a calendar icon in an ASP file. I
    > have a close button in the calendar. When i click on the button, the
    > calendar is not closing.
    >
    > here is the select.js file
    >
    > x999NS4compatib le = (document.layer s);
    > var x999IE4compatib le = (document.all);
    > var x999dayabbs = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];
    > var x999daynames = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday',
    > 'Thursday', 'Friday', 'Saturday' ];
    > var x999monthnames = [ 'January', 'February', 'March', 'April', 'May',
    > 'June', 'July', 'August', 'September', 'October', 'November',
    > 'December' ];
    > var x999monthabbs = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
    > 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
    > var x999weekdays = [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ];
    > var x999months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
    > 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
    > var x999years = new Array(10);
    > for (i = 0; i < x999years.lengt h; i++) x999years[i] = 1999 + i;
    > var x999today = new Date();
    > var x999currentday = x999today.getDa te();
    > var x999currentmont h = x999today.getMo nth();
    > var x999currentyear = x999today.getFu llYear();
    > var x999left = 100;
    > var x999top = 80;
    > var x999width = 220;
    > var x999height = 260;
    > var x999cell_width = 25;
    > var x999cell_height = 25;
    > var x999bg_color = '#0072a0';
    > var x999offsety = 32;
    > var x999fontface = "verdana";
    > var x999weekcolor = "yellow";
    > var x999weeksize= "2";
    > var x999lowyear = 1900;
    > var x999highyear = 2999;
    > var x999weekfont = '<font face="' + x999fontface + '" size="' +
    > x999weeksize + '" color="' + x999weekcolor + '">';
    > var x999font = '<font face="' + x999fontface + '" size="1">';
    > + ";color:#000000 ;font-size:7pt;font-weight:bold;'";
    > var x999stylecombo = "style = 'font-family:" + x999fontface +
    > ";color:#000000 ;font-size:7pt;font-weight:bold;'";
    > var x999style = "style = 'font-family:" + x999fontface +
    > ";BACKGROUN D-COLOR: #004680; FONT-SIZE: xx-small; FONT-WEIGHT: bold;
    > HEIGHT: 22px; WIDTH: 23px ;COLOR: WHITE'";
    > var x999stylebut = "style = 'font-family:" + x999fontface +
    > ";BACKGROUN D-COLOR: #004680; FONT-SIZE: xx-small; FONT-WEIGHT: bold;
    > HEIGHT: 22px; WIDTH: 43px ;COLOR: WHITE'";
    > var x999headerstyle = "style = 'font-family:" + x999fontface +
    > ";color:#000000 ;font-size:1;font-weight:bold;'";
    > var x999daystyle = "style = 'BACKGROUND-COLOR: #004680; FONT-SIZE:
    > xxx-small; FONT-WEIGHT: bold; HEIGHT: 20px; WIDTH: 24px ;COLOR:
    > WHITE;BORDER-TOP:BLUE;BORDER-LEFT:BLUE'";
    > var x999tableborder = '1';
    > var frm_name = '';
    > var frm_fld = ''
    >
    > function x999cal(is_popu p, win,
    > handler,form_na me,field_name,f ield_value,left , top, height,
    > bg_color,width,
    > cell_width, cell_height, sel_month, sel_year)
    > {
    > this.is_popup = is_popup;
    > this.parent = null;
    > this.window = null;
    > if (this.is_popup)
    > this.parent = win;
    > else
    > this.window = win;
    > frm_name = form_name;
    > frm_fld = field_name;
    > fld_val = field_value;
    >
    > this.handler = handler;
    > this.left = left;
    > this.top = top;
    > this.width = width || x999width;
    > this.height = height || x999height;
    > this.cell_width = cell_width || x999cell_width;
    > this.cell_heigh t = cell_height || x999cell_height ;
    > this.bg_color = bg_color || x999bg_color;
    > this.sel_month = sel_month;
    > this.sel_year = sel_year;
    >
    > if((fld_val) != "")
    > {
    > if (fld_val.length > 10 || fld_val.length < 8)
    > {
    > alert("Invalid date");
    > return false;
    > exit();
    > }
    >
    > a=fld_val.split ("/");
    >
    > mon = a[0];
    > dat = a[1];
    > yr = a[2];
    >
    > if (yr == 0000)
    > {
    > alert("This is an invalid year");
    > return false;
    > exit();
    > }
    >
    > else if (mon == null || dat == null || yr == null || mon.length > 2 ||
    > dat.length > 2 || yr.length !=4)
    > {
    > alert("The date format has to be mm/dd/yyyy");
    > return false;
    > exit();
    > }
    >
    > else if (isNaN(mon) == 1 || isNaN(dat) == 1 || isNaN(yr) == 1)
    > {
    > alert("Invalid date : No text form date allowed, only numeric format
    > to be entered");
    > return false;
    > exit();
    > }
    >
    > else if (mon < 1 || mon > 12)
    > {
    > alert("Invalid Date : The date format should be mm/dd/yyyy , month
    > has to be between 1 and 12")
    > return false;
    > exit();
    > }
    >
    > else if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 ||
    > mon == 10 || mon == 12)
    > {
    > if (dat < 1 || dat > 31)
    > {
    > alert("Invalid Date : The date format should be mm/dd/yyyy , the
    > date value you have entered is not a valid date for this month")
    > return false;
    > exit();
    > }
    > }
    >
    > else if(mon == 4 || mon == 6 || mon == 9 || mon == 11)
    > {
    > if(dat < 1 || dat > 31)
    > {
    > alert("Invalid Date : The date format should be mm/dd/yyyy , the
    > date value you have entered is not a valid date for this month")
    > return false;
    > exit();
    > }
    > }
    >
    > else if (mon == 2)
    > {
    > if (yr%4 == 0)
    > {
    > if(yr%100 != 0 || yr%400 == 0)
    > {
    > if (dat < 1 || dat > 29)
    > {
    > alert("Invalid Date : The date format should be mm/dd/yyyy , the
    > date value you have entered is not a valid date for this month")
    > return false;
    > exit();
    > }
    > }
    > }
    > else if (dat < 1 || dat > 28)
    > {
    > alert( "Invalid Date : The date format should be mm/dd/yyyy , the
    > date value you have entered is not a valid date for this month");
    > return false;
    > exit();
    > }
    > }
    > this.sel_year = yr;
    > this.sel_month = mon-1;
    > }
    > else
    > {
    > this.sel_year = x999currentyear ;
    > this.sel_month = x999currentmont h;
    > }
    >
    >
    > this.days = new Array(42);
    > this.cal = null;
    > this.day_table = null;
    >
    > if (x999NS4compati ble)
    > {
    > x999cal.prototy pe.create_cal = x999cal_create_ cal_NS4;
    > x999cal.prototy pe.show_days = x999cal_show_da ys_NS4();
    > }
    > else
    > {
    > x999cal.prototy pe.create_cal = x999cal_create_ cal_IE4;
    > x999cal.prototy pe.show_days = x999cal_show_da ys_IE4;
    > }
    > x999cal.prototy pe.popup_cal = x999cal_popup_c al;
    > x999cal.prototy pe.prev_year = x999cal_prev_ye ar;
    > x999cal.prototy pe.next_year = x999cal_next_ye ar;
    > x999cal.prototy pe.new_year = x999cal_new_yea r;
    > x999cal.prototy pe.prev_month = x999cal_prev_mo nth;
    > x999cal.prototy pe.next_month =
    > x999cal_next_mo nth;x999cal.pro totype.clicked_ day =
    > x999cal_clicked _day;
    > if (x999cal.protot ype.id == null) x999cal.prototy pe.id = 0;
    > x999cal.prototy pe.id++;
    > this.id = x999cal.prototy pe.id;
    > this.cal_id = 'cal' + this.id;
    > this.day_table_ id = 'day_table' + this.id;
    > this.select_for m_id = 'select_form' + this.id;
    > }
    > function x999cal_create_ cal_NS4()
    > {
    > if (this.is_popup)
    > {
    > var x = this.parent.scr eenX + (this.parent.ou terWidth -
    > this.parent.inn erWidth) + (this.left || x999left);
    > var y = this.parent.scr eenY + (this.parent.ou terHeight -
    > this.parent.inn erHeight) + (this.top || x999top);
    > this.window = this.parent.ope n("", this.cal_id, 'screenX=' + x +
    > ',screenY=' + y + ',innerWidth=' + this.width + ',innerHeight=' +
    > this.height + ',scrollbars=no ,resizeable=no' );
    > this.window.doc ument.open(); //Need to open and close document in
    > Navigator
    > this.window.doc ument.writeln(' <title>CCC STS Calendar</title>');
    > this.window.doc ument.close();
    > }
    >
    > this.cal = new Layer(this.widt h, this.window);
    > this.cal.name = this.cal_id;
    > if (this.is_popup)
    > {
    > this.cal.left = 0;
    > this.cal.top = 0;
    > }
    > else
    > {
    > this.cal.left = this.left || x999left;
    > this.cal.top = this.top || x999top;
    > }
    >
    > this.cal.zIndex = 1;
    > this.cal.clip.w idth = this.width;
    > this.cal.clip.h eight = this.height;
    > this.cal.bgColo r = this.bg_color;
    > this.cal.visibi lity = 'show';
    > var doc = this.cal.docume nt;
    > var x999today = new Date();
    > var vYear = x999today.getFu llYear();
    >
    > doc.picker = this;
    > doc.open();
    > doc.writeln("<c enter>");
    > doc.writeln("<t able align='center' border='0' cellpadding='0' >");
    > doc.writeln(" <tr>");
    > doc.writeln(" <td align='center'> ");
    > doc.writeln(" <form name='" + this.select_for m_id + "'>" +
    > x999font);
    > doc.writeln(" <input type='button' value='&lt;&lt; '
    > onClick='docume nt.picker.prev_ year()' " + x999style + ">");
    > doc.writeln(" <input type='button' value='&nbsp;&l t;&nbsp;'
    > onClick='docume nt.picker.prev_ month()' " + x999style + ">");
    > doc.writeln(" <select name='month_sel '
    > onChange='docum ent.picker.new_ year()' " + x999style + " >");
    > for (i = 0; i < x999months.leng th; i++)
    > doc.writeln(" <option value='" + i + "'>" + x999months[i]);
    > doc.writeln(" </select></font>");
    > doc.writeln(" " + x999font + " <input type = 'text' value = '"
    > + vYear + "' size = '4' maxlength = '4' name = 'year_sel' " +
    > x999headerstyle + " onBlur='documen t.picker.new_ye ar()'>\n");
    > doc.writeln(" <input type='button' value='&nbsp;&g t;&nbsp;'
    > onClick='docume nt.picker.next_ month()' " + x999style + ">");
    > doc.writeln(" <input type='button' value='&gt;&gt; '
    > onClick='docume nt.picker.next_ year()' " + x999style + ">");
    > doc.writeln(" </form>");
    > doc.writeln(" </td>");
    > doc.writeln(" </tr>");
    > doc.writeln("</table>");
    > doc.writeln("</center>");
    > doc.close();
    > this.day_table = new Layer(this.widt h, this.cal);
    > this.day_table. name = this.day_table_ id;
    > this.day_table. left = 0;
    > this.day_table. top = x999offsety;
    > this.day_table. zIndex = 2;
    > this.day_table. visibility = 'inherit';
    >
    > }
    >
    > function x999cal_show_da ys_NS4()
    > {
    >
    > var month_select =
    > this.cal.docume nt.forms[this.select_for m_id]['month_sel'];
    > var year_select =
    > this.cal.docume nt.forms[this.select_for m_id]['year_sel'];
    > month_select.se lectedIndex = this.sel_month;
    > year_select.val ue = this.sel_year;
    > var days_in_month = get_days_in_mon th(this.sel_mon th,
    > this.sel_year);
    > var day_of_week_fir st = (new Date(this.sel_y ear, this.sel_month,
    > 1)).getDay() - 0;
    > if (day_of_week_fi rst< 1) day_of_week_fir st += 7;
    > for (i = 0; i < this.days.lengt h; i++) this.days[i] = 0;
    > for (i = 0; i < days_in_month; i++)
    > this.days[i + day_of_week_fir st] = i + 1;
    > var doc = this.day_table. document;
    > doc.picker = this;
    > doc.open();
    > doc.writeln("<c enter>");
    > doc.writeln("<t able align='center' border='" + x999tableborder +
    > "'>");
    > doc.writeln("<f orm>");
    > doc.writeln(" <tr>");
    > for (j = 0; j < x999weekdays.le ngth; j++)
    > {
    > doc.writeln(" <td align='center' valign='middle' width='" +
    > this.cell_width + "' >" + x999weekfont + x999weekdays[j] + "</td>");
    > }
    > doc.writeln(" </tr>");
    > for (i = 0; i < 6; i++)
    > {
    > doc.writeln(" <tr>");
    > for(j = 0; j < 7; j++)
    > {
    > var val = this.days[i * 7 + j];
    > if (val > 0 && val < 10) val = " " + val + " ";
    > if (this.days[i * 7 + j])
    > {
    > doc.writeln(" <td align='center' valign='middle' height='" +
    > this.cell_heigh t + "'>" + x999font + "<input type='button' value='" +
    > val + "' onClick='docume nt.picker.click ed_day(" + this.days[i * 7 + j]
    > + ")'></td>");
    > }
    > else
    > doc.writeln(" <td>&nbsp;</td>");
    > }
    > doc.writeln(" </tr>");
    > }
    > doc.writeln("<i nput type='button' value='Close' onClick='' " +
    > x999stylebut + ">");
    > doc.writeln("</form>");
    > doc.writeln("</table>");
    > doc.writeln("</center>");
    > doc.close();
    > }
    > function x999cal_create_ cal_IE4()
    > {
    > if (this.is_popup)
    > {
    > var x = this.parent.scr eenLeft + (this.left || x999left);
    > var y = this.parent.scr eenTop + (this.top || x999top);
    > this.window = this.parent.ope n("", this.cal_id, 'left=' + x +
    > ',top=' + y + ',width=' + this.width + ',height=' + this.height +
    > ',scrollbars=no ,resizeable=no' );
    > this.window.doc ument.open();
    > this.window.doc ument.writeln(' <title>CCC STS Calendar</title>');
    > this.window.doc ument.close();
    > }
    >
    > this.window.doc ument.body.inse rtAdjacentHTML( "beforeEnd" , "<div id='"
    > + this.cal_id + "' style='position :absolute'></div>");
    > this.cal = this.window.doc ument.all[this.cal_id];
    > if (this.is_popup)
    > {
    > this.cal.style. pixelLeft = 0;
    > this.cal.style. pixelTop = 0;
    > }
    > else
    > {
    > this.cal.style. pixelLeft = this.left || x999left;
    > this.cal.style. pixelTop = this.top || x999top;
    > }
    > this.cal.style. zIndex = 1;
    > this.cal.style. width = this.width;
    > this.cal.style. height = this.height;
    > this.cal.style. backgroundColor = this.bg_color;
    > this.cal.style. visibility = 'visible';
    > this.cal.picker = this;
    > var x999today = new Date();
    > var vYear = x999today.getFu llYear();
    > var str =
    > "<center>\n " +
    > "<table align='center' border='0' cellpadding='0'
    > cellspacing='0' ><tr><td><tab le align='center' border='0'>\n" +
    > " <form name='" + this.select_for m_id + "'>\n" +
    > " <tr>\n" +
    > " <td align='center'> \n" +
    > " <input type='button' " + x999style + " value='&lt;&lt; '
    > onClick='docume nt.all." + this.cal_id + ".picker.prev_y ear()'>\n" +
    > " <input type='button' " + x999style + " value='&lt;&nbs p;'
    > onClick='docume nt.all." + this.cal_id + ".picker.prev_m onth()'>\n" +
    > " <select name='month_sel ' " + x999stylecombo + "
    > onChange='docum ent.all." + this.cal_id + ".picker.new_ye ar()'>\n";
    > for (i = 0; i < x999months.leng th; i++)
    > str += " <option value='" + i + "'>" + x999months[i] + "\n";
    > str += " </select>\n" +
    > " <input type = 'text' value = '" + vYear + "' size = '4'
    > maxlength = '4' name = 'year_sel' " + x999stylecombo + "
    > onBlur='documen t.all." + this.cal_id + ".picker.new_ye ar()'>\n" +
    > " <input type='button' " + x999style + " value='&gt;&nbs p;'
    > onClick='docume nt.all." + this.cal_id + ".picker.next_m onth()'>\n" +
    > " <input type='button' " + x999style + " value='&gt;&gt; '
    > onClick='docume nt.all." + this.cal_id + ".picker.next_y ear()'>\n" +
    > " </td>\n" +
    > " </tr>\n" +
    > " </form>\n" +
    > "</table>\n" +
    > "</center>\n" +
    > "<div id='" + this.day_table_ id + "'
    > style='position :absolute'></div>\n";this.ca l.innerHTML = str;
    > this.day_table = this.window.doc ument.all[this.day_table_ id];
    > this.day_table. style.pixelLeft = 4;
    > this.day_table. style.pixelTop = x999offsety;
    > this.day_table. style.zIndex = 2;
    > this.day_table. style.visibilit y = 'inherit';
    > this.day_table. picker = this;
    >
    > }
    >
    > function y2k(number)
    > {
    > return (number < 1000) ? number + 1900 : number;
    > }
    >
    > function getWeek(year,mo nth,day)
    > {
    > var when = new Date(year,month ,day);
    > var newYear = new Date(year,0,1);
    > var offset = 7 + 1 - newYear.getDay( );
    > if (offset == 8) offset = 1;
    > var daynum =
    > ((Date.UTC(y2k( year),when.getM onth(),when.get Date(),0,0,0) -
    > Date.UTC(y2k(ye ar),0,1,0,0,0)) /1000/60/60/24) + 1;
    > var weeknum = Math.floor((day num-offset+7)/7);
    > if (month == 0 && weeknum > 7) weeknum = 0;
    > if (offset != 1) weeknum = weeknum + 1;
    > if (weeknum == 0) {
    > year--;
    > var prevNewYear = new Date(year,0,1);
    > var prevOffset = 7 + 1 - prevNewYear.get Day();
    > if (prevOffset == 2 || prevOffset == 8) weeknum = 53; else
    > weeknum = 52;
    > }
    > return weeknum;
    > }
    >
    > function x999cal_show_da ys_IE4()
    > {
    > var month_select =
    > this.window.doc ument.forms[this.select_for m_id]['month_sel'];
    > var year_select =
    > this.window.doc ument.forms[this.select_for m_id]['year_sel'];
    > month_select.se lectedIndex = this.sel_month;
    > year_select.val ue = this.sel_year;
    > var days_in_month = (new Date(this.sel_y ear, this.sel_month+ 1,
    > 0)).getDate();
    > var day_of_week_fir st = (new Date(this.sel_y ear, this.sel_month,
    > 1)).getDay() - 0;
    > if (day_of_week_fi rst< 0 ) day_of_week_fir st += 7;
    > for (i = 0; i < this.days.lengt h; i++) this.days[i] = 0;
    > for (i = 0; i < days_in_month; i++)
    > this.days[i + day_of_week_fir st] = i + 1;
    > var str =
    > "<center>\n " +
    > "&nbsp;&nbsp;<t able align='center' border='" + x999tableborder +
    > "'>\n" +
    > "<form>\n" +
    > " <tr>\n";
    > for (j = 0; j < x999weekdays.le ngth; j++)
    > {
    > str += " <td align='center' valign='middle' width='" +
    > this.cell_width + "'>" + x999weekfont + x999weekdays[j] + "</td>\n";
    > }
    > str += " </tr>\n";
    > for (i = 0; i < 6; i++)
    > {
    > str += " <tr>\n";
    > for(j = 0; j < 7; j++)
    > {
    > var val = this.days[i * 7 + j];
    > if (val > 0 && val < 10) val = " " + val + " ";
    > if (this.days[i * 7 + j])
    > {
    > str += " <td align='center' valign='middle' height='" +
    > this.cell_heigh t + "'>" + x999font + "<input type='button' " +
    > x999daystyle + " value='" + val + "' onClick='docume nt.all." +
    > this.day_table_ id + ".picker.clicke d_day(" + this.days[i * 7 + j] +
    > ")'></td>\n";
    > }
    > else
    > str += " <td>&nbsp;</td>\n";
    > }
    >
    > str += " </tr>\n";
    > }
    > str +=
    > "</form>\n" +
    > "</table>\n" +
    > "</center>\n" +
    > "<input type='button' value='Close' onClick='x999ca l_clicked_day(1 )'"
    > + x999stylebut + ">";
    >
    > this.day_table. innerHTML = str;
    > }
    >
    > function funclose_button ()
    > {
    >
    > var dt1 = eval("document. "+frm_name+"."+ frm_fld);
    > var x999today = new Date();
    > var x999currentday = x999today.getDa te();
    > var x999currentmont h = x999today.getMo nth();
    > var x999currentyear = x999today.getFu llYear();
    > dt1.value = x999currentday + '/' + x999currentmont h+1 + '/' +
    > x999currentyear ;
    > }
    > function x999cal_popup_c al()
    > {
    > if (this.is_popup)
    > {
    > if (this.cal && this.window && !this.window.cl osed)
    > this.window.clo se();
    > else
    > {
    > this.create_cal ();
    > this.show_days( );
    > }
    > }
    > else
    > {
    > if (!this.cal)
    > {
    > this.create_cal ();
    > this.show_days( );
    > }
    > else
    > {
    > if (x999NS4compati ble)
    > {
    > if (this.cal.visib ility == 'show')
    > this.cal.visibi lity = 'hide';
    > else
    > this.cal.visibi lity = 'show';
    > }
    > else
    > {
    > if (this.cal.style .visibility == 'visible')
    > this.cal.style. visibility = 'hidden';
    > else
    > this.cal.style. visibility = 'visible';
    > }
    > }
    > }
    >
    > }
    >
    > function x999cal_new_yea r()
    > {
    >
    > var month_select =
    > this.cal.docume nt.forms[this.select_for m_id]['month_sel'];
    > this.sel_month = new
    > Number(month_se lect.options[month_select.se lectedIndex].value);
    > var year_select =
    > this.cal.docume nt.forms[this.select_for m_id]['year_sel'];
    > this.sel_year = new Number(year_sel ect.value);
    > if ( (isNaN(parseInt (this.sel_year) )) || (this.sel_year < x999lowyear)
    > || (this.sel_year > x999highyear) )
    > {
    >
    > window.alert('T his is not a valid year.');
    > var x999today = new Date;
    > var yr = x999today.getFu llYear();
    > this.sel_year = yr;
    > }
    > this.show_days( );
    > function");
    >
    > }
    >
    > function x999cal_clicked _day(day)
    > {
    >
    > day = 5;
    > alert(day);
    >
    > if (this.is_popup)
    > this.window.clo se();
    > if (x999NS4compati ble)
    > this.cal.visibi lity = 'hide';
    > else
    > this.cal.style. visibility = 'hidden';
    > var sel_date = new Date(this.sel_y ear, this.sel_month, day);
    > if (this.handler) this.handler(th is, sel_date);
    >
    > }
    >
    > function twodigit(num)
    > {
    >
    > var numStr = num + '';
    > if (numStr.length == 1)
    > {
    > numStr = "0" + numStr;
    > }
    >
    > return numStr;
    >
    > }
    >
    > function righttwodigits( num)
    > {var numStr = num + '';
    > if (numStr.length == 4) {
    > numStr = numStr.substrin g(1,3);}
    >
    > return numStr;
    > }
    >
    > function get_days_in_mon th(mon, yr)
    > {
    >
    > var month = new Number(mon);
    > var year = new Number(yr);
    > var mdays = [ [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
    > [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ];
    > var isleap =
    > (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0;
    > return mdays[isleap][month];}
    > function my_date_selecte d(cal, date)
    > {
    > var dt = eval("document. "+frm_name+"."+ frm_fld);
    > dt.value = twodigit(date.g etMonth() + 1) + '/' +
    > twodigit(date.g etDate()) + '/' + date.getFullYea r();
    > }
    > if i include window.close( for the close button, the whole parent
    > window is only closing. I want to close only the calendar.
    >
    >
    > vinu[/color]


    1) What invokes the calendar; perhaps "x999cal(.. .)"?

    2) "function x999cal_new_yea r()" contains the following line:

    function");

    Don't you get an error?

    3) Why "var x999months" and "var x999monthabbs"; they're equal?


    Comment

    • Dr John Stockton

      #3
      Re: javascript calendar

      JRS: In article <80bPb.90337$sv 6.289997@attbi_ s52>, seen in
      news:comp.lang. javascript, McKirahan <News@McKirahan .com> posted at Tue,
      20 Jan 2004 14:34:45 :-
      [color=blue]
      >Lines: 663[/color]
      [color=blue][color=green]
      >> ... ... ... ...[/color][/color]

      Please trim your quotes, as per FAQ. We've already seen all that
      rubbish.
      [color=blue][color=green]
      >>
      >> vinu[/color]
      >
      >
      >1) What invokes the calendar; perhaps "x999cal(.. .)"?
      >
      >2) "function x999cal_new_yea r()" contains the following line:
      >
      > function");
      >
      > Don't you get an error?
      >
      >3) Why "var x999months" and "var x999monthabbs"; they're equal?
      >
      >[/color]


      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

      Comment

      • Dr John Stockton

        #4
        Re: javascript calendar

        JRS: In article <vinu.10c3wn@ma il.forum4design ers.com>, seen in
        news:comp.lang. javascript, vinu <vinu.10c3wn@ma il.forum4design ers.com>
        posted at Tue, 20 Jan 2004 07:55:23 :-[color=blue]
        >
        >I have a javascript file named select.js. This is a file which is used
        >to pop up a calendar, when clicked on a calendar icon in an ASP file. I
        >have a close button in the calendar. When i click on the button, the
        >calendar is not closing.[/color]

        Read the FAQ before posting to a newsgroup.

        Code lines should be appropriately wrapped by hand, or written so that
        they do not need it; do not let them be broken by inferior software, as
        that makes your material illegible and unexecutable.

        Your code is highly inefficient; if it is yours, you are evidently well
        beyond your competence level.

        Date validation, given Y. M, D as numbers or strings, requires two lines
        of code. Not two pages.

        A function to validate a string containing a date in numeric form, and
        to return a Date Object or undefined, can be done in five lines.

        Get yourself a proper news service, and proper standards-compliant
        software to access it.

        --
        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
        <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

        Comment

        • rf

          #5
          Re: javascript calendar


          "vinu" <vinu.10c3wn@ma il.forum4design ers.com> wrote in message
          news:vinu.10c3w n@mail.forum4de signers.com...[color=blue]
          >[/color]
          <snip bulk code>

          Posted via http://www.forum4designers.com

          Do you realize that you are not posting to a webiste forum when you use this
          site. They are passing your posts on to the usenet newsgroup
          comp.lang.javas cript

          comp.lang.javas cript is a publicly available newsgroup. The website you are
          using is stealing its content directly from there and pretending that it is
          their own. There is no original material at all on the website you are
          looking at now. It is all coming directly from usenet.

          I suggest you obtain a newsreader and visit us at
          ews:comp.lang.j avascript - you
          will get a far better reaction to your question there.

          Cheers
          Richard.



          Comment

          • rf

            #6
            Re: javascript calendar


            "Dr John Stockton" <spam@merlyn.de mon.co.uk> wrote in message
            news:ZidaE9KQGZ DAFwzV@merlyn.d emon.co.uk...[color=blue]
            > JRS: In article <vinu.10c3wn@ma il.forum4design ers.com>, seen in
            > news:comp.lang. javascript, vinu <vinu.10c3wn@ma il.forum4design ers.com>
            > posted at Tue, 20 Jan 2004 07:55:23 :-[color=green]
            > >
            > >I have a javascript file named select.js. This is a file which is used[/color]
            >
            > Read the FAQ before posting to a newsgroup.[/color]

            Dr John, these people are not aware the are posting to a newsgroup. Please
            visit the offending web site mentioned in their sig. They think they are
            posting to a private forum. See also my other post to this thread.

            Cheers
            Richard.



            Comment

            • Dr John Stockton

              #7
              Re: javascript calendar

              JRS: In article <TzuPb.22085$Wa .5789@news-server.bigpond. net.au>, seen
              in news:comp.lang. javascript, rf <making.it.up@t he.time> posted at Wed,
              21 Jan 2004 12:49:55 :-[color=blue]
              >
              >"Dr John Stockton" <spam@merlyn.de mon.co.uk> wrote in message
              >news:ZidaE9KQG ZDAFwzV@merlyn. demon.co.uk...[color=green]
              >> JRS: In article <vinu.10c3wn@ma il.forum4design ers.com>, seen in
              >> news:comp.lang. javascript, vinu <vinu.10c3wn@ma il.forum4design ers.com>
              >> posted at Tue, 20 Jan 2004 07:55:23 :-[color=darkred]
              >> >
              >> >I have a javascript file named select.js. This is a file which is used[/color]
              >>
              >> Read the FAQ before posting to a newsgroup.[/color]
              >
              >Dr John, these people are not aware the are posting to a newsgroup.[/color]

              That is their problem, not mine; I am sufficiently aware of the
              situation. They are responsible for their own actions, which includes
              their choice of service; and they must expect to receive appropriate
              treatment. If they do not like that, they should complain to the owner
              of the site that they use, for attempting unsuccessfully to deceive
              them.

              The owners of forum4designers indeed should have subscribed to the
              newsgroup, read the FAQ, and asked for overwhelming consent - which
              would, I trust, not have been granted - before doing what they have
              done. And they should recommend strongly that their users, who can be
              presumed to be naive, should read a group for a while, and seek its FAQ,
              before writing to it.

              --
              © John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v4.00 MIME. ©
              Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
              Check boilerplate spelling -- error is a public sign of incompetence.
              Never fully trust an article from a poster who gives no full real name.

              Comment

              • Lasse Reichstein Nielsen

                #8
                Re: javascript calendar

                Dr John Stockton <spam@merlyn.de mon.co.uk> writes:
                [color=blue]
                > The owners of forum4designers indeed should have subscribed to the
                > newsgroup, read the FAQ, and asked for overwhelming consent - which
                > would, I trust, not have been granted - before doing what they have
                > done.[/color]

                I don't see why they need consent. Usenet is not restricted to access
                with a newsreader, and there are other web interfaces to other
                newsgroups that work fine.

                They should ofcourse be exepected to understand the medium and make an
                effort to inform their users of what they are really accessing. If
                they did so, we would just have to correct the occasional clueless who
                don't read warnings anyway.

                (This is how it works with the web-access to Danish web groups at the
                html.dk web site - they did catch some flak until they made it more
                visible that it was newsgroups, but now it's not a problem).

                Now, if they *don't* make an effort to cooperate, the newsgroup will
                just do as it usually does: police itself. That includes speaking ill
                about their web site at every chance :)

                /L
                --
                Lasse Reichstein Nielsen - lrn@hotpop.com
                DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                'Faith without judgement merely degrades the spirit divine.'

                Comment

                • Richard Cornford

                  #9
                  Re: javascript calendar

                  "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                  news:u12on6nz.f sf@hotpop.com.. .[color=blue]
                  > Dr John Stockton <spam@merlyn.de mon.co.uk> writes:[/color]
                  <snip>[color=blue]
                  >They should ofcourse be exepected to understand the medium
                  >and make an effort to inform their users of what they are
                  >really accessing.[/color]
                  <snip>

                  That is really the crux of the matter. forum4designers .com seem to be
                  actively trying to give the impression that the "forums" that they make
                  available are a service that they provide instead of an (inappropriatel y
                  formatted) reproduction of comp.lang.javas cript discussions (along with
                  numerous other news groups).

                  It is the misrepresentati on that is objected to not the web based
                  access. That is available at many sites including groups.google.c om and
                  they are not that difficult to find. Try doing a web search from you
                  name on google, I get 10 pages of results mostly sites providing web
                  access to (or reporting of) comp.lang.javas cript. The majority make no
                  pretence about the nature or origin of their content, for example:-

                  When it comes to designing and building a website, the quality is dependent on how much you’re willing to pay. In the contemporary landscape of web development, it’s imperative that your web designer can employ the best and most effectiveRead More

                  MainFrameForum is a mainframe discussion forum. Z/OS OS/390 VM VSE LINUX z/Series help desk. IBM and ISV program products. IT-Jobs IT-contracts


                  OTOH searching form my name turned up:-



                  -who appear to be just a guilty of misrepresenting Usenet as their own
                  work as forum4designers .com (and similarities in presentation suggest
                  are using exactly the same software).

                  Richard.


                  Comment

                  • Randy Webb

                    #10
                    Re: javascript calendar

                    Richard Cornford wrote:

                    [color=blue]
                    > http://www.tutorgig.com/
                    >
                    > -who appear to be just a guilty of misrepresenting Usenet as their own
                    > work as forum4designers .com (and similarities in presentation suggest
                    > are using exactly the same software).[/color]

                    Thats one rude site there. :-x

                    --
                    Randy
                    Chance Favors The Prepared Mind

                    Comment

                    • Dr John Stockton

                      #11
                      Re: javascript calendar

                      JRS: In article <u12on6nz.fsf@h otpop.com>, seen in
                      news:comp.lang. javascript, Lasse Reichstein Nielsen <lrn@hotpop.com >
                      posted at Thu, 22 Jan 2004 01:55:28 :-[color=blue]
                      >Dr John Stockton <spam@merlyn.de mon.co.uk> writes:
                      >[color=green]
                      >> The owners of forum4designers indeed should have subscribed to the
                      >> newsgroup, read the FAQ, and asked for overwhelming consent - which
                      >> would, I trust, not have been granted - before doing what they have
                      >> done.[/color]
                      >
                      >I don't see why they need consent.[/color]

                      Good manners, at the very least; to enquire whether they would be
                      welcome, and what they should do to make that welcome less grudging
                      and/or more enthusiastic.
                      [color=blue]
                      > Usenet is not restricted to access
                      >with a newsreader, and there are other web interfaces to other
                      >newsgroups that work fine.[/color]

                      Those too should have asked; Usenet and newsreaders were designed for
                      each other, and an alien form of access does not necessarily fit well.
                      The only one I am familiar with is Google, which I believe to be both
                      honest and competent, and to provide additional services to the whole
                      Net community. But, in archiving permanently what was designed as an
                      ephemeral medium, they too are at fault.

                      [color=blue]
                      >They should ofcourse be exepected to understand the medium and make an
                      >effort to inform their users of what they are really accessing. If
                      >they did so, we would just have to correct the occasional clueless who
                      >don't read warnings anyway.
                      >
                      >(This is how it works with the web-access to Danish web groups at the
                      >html.dk web site - they did catch some flak until they made it more
                      >visible that it was newsgroups, but now it's not a problem).
                      >
                      >Now, if they *don't* make an effort to cooperate, the newsgroup will
                      >just do as it usually does: police itself. That includes speaking ill
                      >about their web site at every chance :)[/color]

                      And of the naiveté of there users, on occasions where this is shown.

                      ISTM that FAQ S.3.2 could have a sentence recommending the use of a
                      well-written newsreader, and linking to a page that says more. It might
                      give examples of good newsreaders and of good Web interfaces, and refer
                      to the foibles and failings of some systems.

                      --
                      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
                      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                      Comment

                      Working...