将表单值传递给数组,然后与/ date(JavaScript)进行比较

时间:2013-04-08 15:58:29

标签: javascript arrays forms frontend

卡住了。我正在尝试将表单下拉选项传递给数组,然后对它们运行if ... else语句,以查看它们是否超过当前日期。

坚持将表单值传递给数组。

链接到jsFiddle:http://jsfiddle.net/Knqec/16/

 var e = document.getElementById("EventDate");
  var things = [];
    function getList(things){
    for (var i=0; i < e.length; i++)
        fields.options[i].text;
        things.push(fields);
          }

Date.prototype.toString = function () { 
return[['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',       'September', 'October', 'November', 'December'] [this.getMonth()] + " "+ this.getDate() +"     "+ this.getFullYear()].join('+');
}; 

HTML

<form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-    urlencoded" action="http://info.kinnser.com/index.php/leadCapture/save" id="mktForm_145" name="mktForm_145">
<ul class='mktLblLeft'>

<li  class='mktFormReq mktField' >

<label>EVENT DATE:</label><span class='mktInput'>

<select class='mktFormSelect mktFReq' name="EventDate" id="EventDate" size='1'       tabIndex='1'>
<option value='' selected='selected'>Please Select...</option>
<option value='April 3 2013'>April 3 2013</option>
<option value='April 17'>April 17 2013</option>
<option value='May 1'>May 1 2013</option>
<option value='May 15'>May 15 2013</option>
<option value='May 29'>May 29 2013</option><option value='June 12'>June 12     2013</option>
<option value='June 26'>June 26 2013</option></select>
<span class='mktFormMsg'></span></span></li>
</form>

0 个答案:

没有答案