Can't open the date time picker

Discussion in 'JavaScript' started by yuenli, Jul 3, 2007.

  1. #1
    HI! I integrated a js file in my javascript and when click on the calender icon there should be a small calender picker for user to select date. but the problem is when i click on the calender icon there was nothing appear. Where is the problem? Thanks in advance. Here is my code: :)

    <html>
    <head>
    <title>test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script language="javascript" type="text/javascript" src="datetimepicker.js">

    //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
    //Script featured on JavaScript Kit (http://www.javascriptkit.com)
    //For this script, visit http://www.javascriptkit.com

    </script>

    <script language="javascript">
    function load() {
    document.getElementById('mytable').onclick = getcell;
    }
    var editwindow = undefined; //glocal variable
    var cellEdit = undefined; //glocal variable
    function getcell(e){
    if(!e) {e=window.event;}
    var tgt = e.target || e.srcElement; //get hit target
    cellEdit = tgt;
    editwindow = open("javascript:","editWindow","width=200,height=200");
    writePageDetail(editwindow.document, tgt);
    }
    function writePageDetail(doc, cell){
    doc.open();
    doc.write("<html><head><title>Edit Window</title></head><body>Task Name: "+cell.firstChild.data+"<p><p>");
    doc.write("<input type='text' id='text1' value='"+cell.firstChild.data+"'><p>");
    doc.write("<input id='demo1' type='text' size='15'><a href='javascript:NewCal('demo1','ddmmyyyy')'>"+
    "<img src='cal.gif' width='16' height='16' border='0' alt='Pick a date'></a><p>"); //insert date
    doc.write("<input type='button' onclick='opener.rowCallback(document)' value='Ok'>");
    doc.write("</body></html>");
    doc.close();
    }// end writePageDetail

    function rowCallback(doc){ //updating value
    if (!cellEdit) {return;} // something is wrong
    cellEdit.innerHTML = doc.getElementById("text1").value;
    cellEdit = undefined;
    editwindow.close();
    } //end rowCallback
    </script>
    </head>

    <body >
    <table border='1'>
    <thead>
    <tr><td>Task No.</td><td>Task Name</td><td>Ownership</td><td>May</td><td>June</td></tr>
    </thead>
    <tbody id="mytable" onclick="load()">
    <tr>
    <td>click 1</td>
    <td>click 2</td>
    <td>click 3</td>
    <td>color</td>
    <td>color</td>
    </tr>
    <tr>
    <td>click 4</td>
    <td>click 5</td>
    <td>click 6</td>
    <td>color</td>
    <td>color</td>
    </tr>
    </tbody>
    </table>
    <p><p>
    <input type="button" value="Insert new row" onclick="insert(this.form)">
    </body>
    </html>
     
    yuenli, Jul 3, 2007 IP