JavaScript Script working in IE not FF
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 6 of 6

Thread: Script working in IE not FF

Threaded View

  1. #1
    Join Date
    Sep 2004

    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?

                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 12:55 PM. 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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a survey!

On-Demand Webinars (sponsored)