Handling onPropertyChange in Firefox

IE non-standard onPropertyChange is a huge problem in most of the places. I was working on a work of moving an application designed to work on IE to a cross-browser standard. For some of the forms, there is a pop up and on the close button of the pop up, it used to update some of the fields in the opener page as:

    function fnClose(rowid){
        var taxHTML = document.getElementById("taxvalues").innerHTML;
        window.opener.document.getElementById("taxvalues").innerHTML=taxHTML;
        window.opener.document.getElementById("hdnTax").value=rowid;
        //There is a event handler on this element in the opener using "onPropertyChange=fnPopClosed(this.value);"
        window.close();
    }

There is a hidden field in the opener and onPropertyChange event of the hidden field was handled to accomplish the final task. On the opener page there was a call to a javascript function triggered by the onPropertyChange event of the hidden field. Though IE gracefully handles the situation, Firefox and other browsers have never heard of such an event. So there is no activity.

I studied a lot of techniques to emulate the onPropertyChange event including adding a eventlistener. After around three hours of tweaking different ideas, I finally wired up the same in a different technique. I called the javascript method in the opener page directly from the pop up like this:

    function fnClose(rowid){
        var taxHTML = document.getElementById("taxvalues").innerHTML;
        window.opener.document.getElementById("taxvalues").innerHTML=taxHTML;
        window.opener.fnPopClosed(rowid);
        window.close();
    }


And I got what I wished to have.

Enjoy javascripting....

Posted: Oct 05 2008, 16:19 by Admin | Comments (6) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Category: Javascript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading