1
<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(){
        var fromObj,toObj;
        fromObj=new JsDatePick({
            useMode:2,  target:"inputField1",dateFormat:"%d-%M-%Y"

        });     
        toObj=new JsDatePick({
            useMode:2,
            target:"inputField2",
            dateFormat:"%d-%M-%Y"

        });             

function viewAlert(){
    //what i need to put it here?   

}

    };
</script>
</head>
<body>
<form name="form1">

<table align="center">
    <tr><td>from:</td><td><input type="text" size="12" id="inputField1" name="from" /></td></tr>
    <tr><td>to:</td><td><input type="text" size="12" id="inputField2" name="to" onblur="viewAlert()" /></td></tr>
    </table>

    </form>

我创建了两个从 jsDatePicker 获取日期的输入字段。输入这些日期后,我需要在警报框中显示所选日期的天数。为此我需要做什么?

提前致谢

4

1 回答 1

0
var msDay = 24*60*60*1000; 
var days = Math.round(Math.abs((fromObj.getTime() - toObj.getTime())/(msDay )));
于 2012-07-06T10:24:23.987 回答