cross domain communication on enter key press

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pankaj17
    New Member
    • Nov 2008
    • 7

    cross domain communication on enter key press

    hello ,

    Cross-Domain Communication Between IFrames

    in this script they have included 2 iframes. parent can send a message to both iframes and frames can send massage to each other.

    they have called the function at particular event . I don't want to call the function at particular event.(they have sent the message at button (sentbtn) click event) .


    in My example i have 2 or more text box these are generated dynamically . and when user will write some thing in text box, will press the enter button that time i want to call the javascript function that is present in another iframe (domain is different).....

    code is really complicated to understand .......

    note: iframe domain is not same
    text box id is not same. id is generated dynamically.

    help me out to solve this ....
  • xNephilimx
    Recognized Expert New Member
    • Jun 2007
    • 213

    #2
    From what you're saying, I guess it's just a matter of changing the event that fires the action. In the original script the do it on submit, you can do it on keyup and if the key is 13 (enter) it will call the proper function.


    Code:
    window.onkeyup = function( e ) {
        if( !e ) var e = window.event;
        var key = e.keyCode ? e.keyCode : e.which;
        
        if( key == 13 ) {
            //do what you have to do in here
        }
    }

    Comment

    Working...