Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何根据所选日期显示警告_Javascript_Jsp_Date - Fatal编程技术网

Javascript 如何根据所选日期显示警告

Javascript 如何根据所选日期显示警告,javascript,jsp,date,Javascript,Jsp,Date,在下面的代码中,我试图根据用户选择的日期显示一条消息。如果日期大于2014年4月26日,则警告数量应为50000;如果日期小于2014年4月26日,则警告数量应为25000。用户选择的日期来自代码1,计算需要在else if块下的代码2中。我已经试着做了以下的事情,但是没有成功。请帮忙 代码1: <div class="input-section"> <p class="label">Shipping Date</p&

在下面的代码中,我试图根据用户选择的日期显示一条消息。如果日期大于2014年4月26日,则警告数量应为50000;如果日期小于2014年4月26日,则警告数量应为25000。用户选择的日期来自代码1,计算需要在else if块下的代码2中。我已经试着做了以下的事情,但是没有成功。请帮忙

代码1:

<div class="input-section">
                        <p class="label">Shipping Date</p>
                        <input type="hidden" name="sShippingDate" id="sShippingDate" value="<fmt:formatDate pattern="MM/dd/yyyy" value="${claim.clMailingDate}" /> " />  
                        <p class="info" id="shipDateValue">
                            <fmt:formatDate pattern="MM/dd/yyyy" value="${claim.clMailingDate}" />

我可以通过做以下更改来解决它

 _setWarningAmount = function _setWarningAmount(cod, registered, shippingDate) {
        var x = new Date(shippingDate);
        var y = new Date('04/26/2014');

        if (cod) {
            _warningAmount = 1000;
        } else if (registered && x > y)   {
            _warningAmount = 50000;
        } else if (registered && x < y)   {
            _warningAmount = 25000;
        } else {
            _warningAmount = 5000;
        }

        _updateWarningAmount();


    },
 _setWarningAmount = function _setWarningAmount(cod, registered, shippingDate) {
        var x = new Date(shippingDate);
        var y = new Date('04/26/2014');

        if (cod) {
            _warningAmount = 1000;
        } else if (registered && x > y)   {
            _warningAmount = 50000;
        } else if (registered && x < y)   {
            _warningAmount = 25000;
        } else {
            _warningAmount = 5000;
        }

        _updateWarningAmount();


    },