Use javascript function from other .html file

L

lordslayer

Helo!

I have a little problem.
My whole page (index.html) is based on one big table and an iFrame. In
this iFrame one of the pages is a picture-thumbnail page. I found a
javascript to open thumbnailed pictures in a really nice new window
(it's not really a window but an iFrame, that can be moved around).
The problem i am facing is that this window that opens picture is
limited to the size of the index.html iFrame. If a picture is bigger
it stays hidden in the index.html iFrame. The solution i thought of
was that i would put the open thumbnail window script in the
index.html file and call the function from the picture-thumbnail
iFrame file so that it would open in index.html not inside the iFrame.
However so far i haven't been able to find a way to call javascript
functions from other html files. If anyone has any ideas how to solve
this please help....

thnx, lp john
 
L

lordslayer

Thank you sooo much for this. It finally works. I had this problem for
over a month and i had no idea how to solve it....

lp john
 
L

lordslayer

Does by any chance this work only for Mozilla? Because i tried it in
IE and it didn't work... Any ideas why..?

lp John
 
L

lordslayer

What didn't work? It is advisable to quote what you are replying to so that
people that read it will be able to follow the conversation.

blank.html:

<script type="text/javascript">
function myFunctionName(){
alert('It works')
}

<iframe src="blank2.html"></iframe>

And in blank2.html:

<a href="#" onclick="parent.frames.myFunctionName();return false">Test</a>

IE6.0: alert message
Mozilla1.5: alert message
Netscape7.1: alert message

If what you are doing isn't working in Mozilla, then you are doing something
more than what my test page uses to show that it works. Post a URL to a test
page......

And read the FAQ - http://www.jibbering.com/faq/


Helo!

I tried what you suggested and it still works only in Mozilla.
I put my page online at
http://users.volja.net/lordslayer/page/index.html

If you click on "photo" link, there is a thumbnail that opens full
picture correctly only if you use Mozilla .. IE doesn't open it right
.... it still opens it in the iFrame.

"Index.html" contains the javascript. "Foto.html" contains the link to
the javascript in index.html

Maybe if you see it you might better understand my problem... I thank
you again for your help.

lp john
 
L

lordslayer

Helo!

I tried what you suggested and it still works only in Mozilla.
I put my page online at
http://users.volja.net/lordslayer/page/index.html

If you click on "photo" link, there is a thumbnail that opens full
picture correctly only if you use Mozilla .. IE doesn't open it right
... it still opens it in the iFrame.

"Index.html" contains the javascript. "Foto.html" contains the link to
the javascript in index.html

Maybe if you see it you might better understand my problem... I thank
you again for your help.

lp john

Success!!! I've made this damn thing work... It wasn't your
suggestion's fault it was my damn javascript. I located and removed
the mistake so it works great now... Thanx again for the advice about
the function call....

lp john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top