/ Published in: JavaScript
test it with alert(xpires); working well for me. silly goodbarry format
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> var d=new Date(); //get today's date var day=d.getDate() + 8; //add 8 days to today's date var month=d.getMonth() + 1; //add one to the month bc of 0 start var year=d.getFullYear(); var month=new Array(12); //assign the months strings, match goodbarry's month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"; var xpires = (day + "-" + month[d.getMonth()].substr(0,3) + "-" + year); //i set a variable called xpires document.sevenWebinar.ZoneExpiry.value = xpires //write the value of my variable to document.formName.inputName.value </script> === HTML for FORM === <form action="....foo..." enctype="multipart/form-data" method="post" name="sevenWebinar"> <input type="username" name="Username" /> <input type="password" name="Password" /> <input type="hidden" name="ZoneExpiry" /> <input type="submit" value="Submit" /> </form>