简体   繁体   中英

How to use datepicker javascript

I had visited this site:

http://www.monkeyphysics.com/mootools/script/2/datepicker

I followed exactly (I guess) what he said on that site, but still not working. Here's my code:

<!DOCTYPE html>
<html>
<script type="text/javascript" src="js/datepicker.js"></script>
<link rel="stylesheet" href="css/datepicker_jqui.css">        
<style type="text/css">     
input.date {
    width: 150px;
    color: #000;
}
</style>    
<head>
    <title></title>
</head>
<body>
<label>Datepicker with Vista skin:</label>
<input name='date_B' type='text' value='' class='date demo_vista' />

<label>Datepicker with OSX Dashboard skin:</label>
<input name='date_B' type='text' value='' class='date demo_dashboard' />

<label>Datepicker with jQuery UI skin:</label>
<input name='date_B' type='text' value='' class='date demo_jqui' />

<label>Datepicker basic (CSS only):</label>
<input name='date_B' type='text' value='' class='date demo' />

<script type="text/javascript"> 
window.addEvent('load', function() {
    new DatePicker('.demo_vista', { pickerClass: 'datepicker_vista' });
    new DatePicker('.demo_dashboard', { pickerClass: 'datepicker_dashboard' });
    new DatePicker('.demo_jqui', { pickerClass: 'datepicker_jqui', positionOffset: { x: 0, y: 5 } });
    new DatePicker('.demo', { positionOffset: { x: 0, y: 5 }});
});    
</script>    
</body>
</html>

anyone have idea what is wrong with my code, please help

thank you

Actually You're not including your assets. You have to put your links, stylesheets and js files inside the head tag.

<html>
<head>
    <title></title>
    <script type="text/javascript" src="js/datepicker.js"></script>
    <link rel="stylesheet" href="css/datepicker_jqui.css">        
    <style type="text/css">     
        input.date {
            width: 150px;
            color: #000;
        }
    </style>    
</head>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM