here's the code i have so far. i'm trying to make a function, getdate(), but am a little stumped with the date object.
how does it read the values from the month select list and the year select list in the html?
Expand|Select|Wrap|Line Numbers
- <SCRIPT LANGUAGE="JavaScript">
- function validateForm()
- {
- formObj = document.formCard;
- if(formObj.name.value == "")
- {
- document.getElementById("noName").style.visibility = "visible";
- return false;
- }
- if(formObj.card.value == "")
- {
- document.getElementById("noCard").style.visibility = "visible";
- return false;
- }
- if(document.getElementById("number").value.length != 16)
- {
- document.getElementById("numberLength").style.visibility = "visible";
- return false;
- }
- /* var date = new date();
- alert(date.getMonth());
- getdate(); */
- }
- /* function getdate()
- var d = new Date()
- {
- }*/
- </SCRIPT>
Expand|Select|Wrap|Line Numbers
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="left">
- <form id="formCard" name="formCard" method="post" action="" onSubmit="return validateForm()">
- Name:<div id="noName">Please fill out your name</div>
- <br />
- <input name="name" type="text" id="name" size="30" />
- <br />
- <br />
- Card Type:<div id="noCard">Please select a card type</div>
- <br />
- <select name="card" id="card">
- <option value=""> </option>
- <option value="Mastercard">Mastercard</option>
- <option value="Visa">Visa</option>
- </select>
- <br />
- <br />
- Card Number:<span style="color:red;" id="numberLength">Card number length incorrect</span>
- <br />
- <input name="number" type="text" id="number" size="35" />
- <br />
- <br />
- Expiry Date:<span style="color:red;" id="date"></span>
- <br />
- <select name="month">
- <option>Month</option>
- <option value="01">01</option>
- <option value="02">02</option>
- <option value="03">03</option>
- <option value="04">04</option>
- <option value="05">05</option>
- <option value="06">06</option>
- <option value="07">07</option>
- <option value="08">08</option>
- <option value="09">09</option>
- <option value="10">10</option>
- <option value="11">11</option>
- <option value="12">12</option>
- </select>
- <select name="year">
- <option>Year</option>
- <option value="2007">2007</option>
- <option value="2008">2008</option>
- <option value="2009">2009</option>
- <option value="2010">2010</option>
- </select>
- <br />
- <br />
- <input type="submit" name="Submit" value="Submit"/>
- </form></td>
- </tr>
- </table>