Reputation: 13
In a iframe div, I have several pages. whenever user scrolls within that div, I need to update the current page number in parent window (same origin).
To achieve this, I have binded a scroll event to the div element and made the calculations to get current page number in iframe. But, struck how to pass this data to parent window.
Upvotes: 1
Views: 877
Reputation: 5831
You can create a function in your parent page.
Parent
function parentcalc(data)
{
//use your data
}
And call this function in the child like this
iframe
parent.parentcalc(mydata);
Upvotes: 1
Reputation: 943108
You can access the parent frame through the parent
global variable.
Upvotes: 1