How to load function at another location


I have this page:

welcome.html is a frameset and i want to load a function in frame ID "Topmenu".

How is this possible from domain/product.html?

Something like javascript:'/amin/#topmenu.topmenufunction()' ?
Jesper ChristensenProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
Something like this should work:

Open in new window

Jesper ChristensenProgrammerAuthor Commented:
But i am an other document.

I still need to tell the script that it need to look at /admin/welcome.html for the ID.

I want to run the script from /product.html
Alexandre SimõesManager / Technology SpecialistCommented:
But I thought the other document was also being shown inside an iFrame on the product.html.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Jesper ChristensenProgrammerAuthor Commented:
More simple:

function test()

I want to open popup.html in a popup and call test().

Have tried from welcome.html:
someWin ='popup.html', 'someWin','width=600, height=600,scrollbars=1');

But it dosen´t call the function
Alexandre SimõesManager / Technology SpecialistCommented:
For that it's easier because you can just use a CSS based popup like jQuery dialog or something.
In this case the popup is actually part of the page making the function automatically available.

Now, a small side comment:
You shouldn't be embedding javascript in your HTML files.
If instead you put your javascript in js files you can just include and use them without any issues.
This also improves performance because js files are cached by the browsers.
Jesper ChristensenProgrammerAuthor Commented:

Hm it dosen´t answer my question.
I want to open popup.html and call the function test on popup.html.

It´s a closed cms system, so thats why this circus :)
Alexandre SimõesManager / Technology SpecialistCommented:
Ok here's an example using the jQuery dialog I metioned:

I'm using plunker because here I can actually have separated files and clearly replicate your scenario.

Attached is the zip file containing the demo

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jesper ChristensenProgrammerAuthor Commented:
It dosen´t work, but thank you anyway
Alexandre SimõesManager / Technology SpecialistCommented:
What doesn't work?
It's this solution that doesn't work for you? What's wrong?

We can find something else! :)
This is usually the straight forward way to do it.
Jesper ChristensenProgrammerAuthor Commented:
I gave up :(
Alexandre SimõesManager / Technology SpecialistCommented:
Eh, sleep over it and come back whenever you want :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.