开发者

How to send php variable from Colorbox iFrame to parent; and how to have a function involving said variable run on parent without reload

开发者 https://www.devze.com 2023-02-06 19:35 出处:网络
I\'m a bit new to programming so bear with me here. I\'m trying to have a link clicked from within a Colorbox iFrame (each link on parent page opens different Colorbox based on MySQL variables) execu

I'm a bit new to programming so bear with me here.

I'm trying to have a link clicked from within a Colorbox iFrame (each link on parent page opens different Colorbox based on MySQL variables) execute a function in the parent frame without it having to refresh.

The link clicked in the iFrame is for a song, and I'd like to leave the iFrame untouched (ie not close), though the parent-based player will play the specific song...

Is this possible? Am I 开发者_StackOverflow中文版making it too complicated? Solution?

Any help would be more than appreciated.


You can call javascript functions that are defined in the parent window of the iframe by using

parent.yourFunction();

So you can basically have this in the parent:

function myFunction(songID) {
}

and in the iframe call it like this:

parent.myFunction(songID)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号