How to load function at another location

Hi

I have this page:
domain/admin/welcome.html

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:
document.getElementById("Topmenu").contentWindow.topmenufunction();

Open in new window

0
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
0
Alexandre SimõesManager / Technology SpecialistCommented:
But I thought the other document was also being shown inside an iFrame on the product.html.
No?
0
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:

Popup.html:
function test()
{alert("TEST"}

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

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

But it dosen´t call the function
0
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.
http://jqueryui.com/dialog/

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.
0
Jesper ChristensenProgrammerAuthor Commented:
Hi.

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 :)
0
Alexandre SimõesManager / Technology SpecialistCommented:
Ok here's an example using the jQuery dialog I metioned:
http://plnkr.co/edit/6YM6CpWhWuSUYH50QQFs

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
plunk-6YM6CpWhWuSUYH50QQFs.zip
0

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
0
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.
0
Jesper ChristensenProgrammerAuthor Commented:
I gave up :(
0
Alexandre SimõesManager / Technology SpecialistCommented:
Eh, sleep over it and come back whenever you want :)

Cheers!
0
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
JavaScript

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.