如何将日历小部件链接到网站?

时间:2014-02-25 23:55:49

标签: javascript html

我从网站“http://javascriptcalendar.org/javascript-date-picker.php”下载了日历小工具 将所有下载的文件放在同一文件夹中 但不知道如何在我的网站上使用日历

这是要显示的基本代码

<html>
  <head>
    <table>
      <tr>
         <td>to:<script src="calendar.html"></script></td>
         <td>from:<script src="calendar.html"></script></td>
     </tr>

     </table>
   </head>
 <body>
 </body>
</html> 

有些人可以建议如何包含它,我很新,你的帮助非常感谢。

高级thx SRINIVAS

2 个答案:

答案 0 :(得分:0)

基本设置:

HTML:

<input type="text" size="12" id="inputField" />     

JavaScript的:

window.onload = function(){
                new JsDatePick({
                    useMode:2,
                    target:"inputField"
                });
};

http://jsfiddle.net/6mS3a/

答案 1 :(得分:0)

将这两行代码复制粘贴到您希望日历可用的每个页面

<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />

<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>

脚本:

<script type="text/javascript">
window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField",
        dateFormat:"%d-%M-%Y"
        /*selectedDate:{                This is an example of what the full configuration offers.
            day:5,                      For full documentation about these settings please see the full version of the code.
            month:9,
            year:2006
        },
        yearsRange:[1978,2020],
        limitToToday:false,
        cellColorScheme:"beige",
        dateFormat:"%m-%d-%Y",
        imgPath:"img/",
        weekStartDay:1*/
    });
};
</script>

HTML:

<body>
    From:<input type="text" size="12" name="from" id="inputField" />
    To: <input type="text" size="12" name="to" id="inputField" />
</body>

希望这有帮助。