I have a form like this:
<form id="loginCompact" action="https://ppe.gamingsystem.net/customerauthn/pl/login" name="sportsbook" method="post" onsubmit="createCookie('BRLOG', document.sportsbook.username.value, 1)">
<input type="text" name="username" class="loginUsername" />
...other fields...
</form>
And this is the Javascript function that's called:
<script type="text/javascript">
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/; domain='broburysports.com'";
}
</script>
However, the cookie is not getting set when the form is submitted. It was working fine when attached to the onclick
handler of the button, but not on onsubmit
. Any ideas?