Return to Snippet

Revision: 16847
at August 18, 2009 03:23 by stayce


Updated Code
<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>

Revision: 16846
at August 18, 2009 03:10 by stayce


Initial Code
<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>

test it with alert(xpires);  working well for me.  silly goodbarry format

Initial URL


Initial Description
test it with alert(xpires);  working well for me.  silly goodbarry format

Initial Title
Goodbarry / Business Catalyst - Set Expiry on Secure Zone form - Javascript

Initial Tags


Initial Language
JavaScript