Not a JS guru, so can someone tell me why the following works on a .net aspx page in Javascript for IE, but no FF (v11)? The FF console shows no errors. The alert commented out below shows the correct date in the 1-1-1900 format when entered in the 1/1/1900 format. But, even if I use the 1-1-1900 entry, FF does not calculate age and place in txtAge. IE works great.
HTML Code:getAge = function(form) { document.getElementById('txtDOB').value = (document.getElementById('txtDOB').value).replace(new RegExp("/", "g"), "-"); //alert(document.getElementById('txtDOB').value); var now = new Date(); var DOB = new Date(document.getElementById('txtDOB').value); var oneDay = 1000 * 60 * 60 * 24 * 365; //converts from milliseconds document.getElementById('txtAge').value = parseInt((now.getTime() - DOB.getTime()) / oneDay); } <asp:TextBox ID="txtDOB" runat="server" onBlur="javascript:getAge(this.form);" />


Reply With Quote

Bookmarks