CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Sep 2004
    Posts
    12

    Script working in IE not FF

    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?

    Code:
                getAge = function(form) {
                    document.getElementById('txtDOB').value = ((document.getElementById('txtDOB').value).replace(new RegExp("/", "g"), "-"));
                    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" onkeyup="javascript:getAge(this.form);" onkeydown="javascript:getAge(this.form);" />
    Last edited by PeejAvery; April 21st, 2012 at 11:55 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured