473,216 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

Calling functions in different documents

Hello people, my first post here... *wave*

I need to know how to call a function in a different document. At the
moment I've tried onFocus but I'm kinda in over my depth. Perhaps if I tell
you what I want to do you can give me the process and I'll go figure out the
code?

My site is divided into two frames, top frame for navigation, bottom frame
for displaying content (called "top" and "main" respectively).

"top" contains 6 images within 6 seperate anchors, that I use as buttons to
switch between sections, the sections being displayed in "main". When the
mouse is over an image, it changes because I use "OnMouseOver", similarly
for "OnMouseOut".

Here is where I get stuck. I want a different image to be displayed as the
relevant button in "top" depending on which main section is loaded into
"main".

I was hoping to solve this by using "onLoad=" in each of the main pages for
each section, that will call a function in "top.html" to cycle through the
list of images changing the relevant image depending on the content of
"main".

I can see an inherent problem here, I have to make every page (could be
hundreds! - nightmare) call this function.

Is there any help you can offer please?

Kind regards,
Steve :)
Jul 20 '05 #1
3 4289
"Twinkletoes" <no****@nospam.noviagra> writes:
I can see an inherent problem here, I have to make every page (could be
hundreds! - nightmare) call this function.
Lots of work, yes.
Is there any help you can offer please?


How about changing the image when you click on the button?
Clicking will initiate the loading of the main frame, so you can change
the image of the button right away.

This will *not* work if you follow a link in the main page to another
section. If that is possible, you will need code on the page in the
main frame to update the menu.
Ok, if you are desperate, you can make the top frame check the
location of the main frame every second, and then update the images
accordingly.

setInterval(function(){testLocation(parent.frames['main'].location);},1000);

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
In a flash of pure inspiration, Lasse Reichstein Nielsen declared:
"Twinkletoes" <no****@nospam.noviagra> writes: How about changing the image when you click on the button?
Clicking will initiate the loading of the main frame, so you can
change the image of the button right away.

This will *not* work if you follow a link in the main page to another
section. If that is possible, you will need code on the page in the
main frame to update the menu.


Ah, this sounds like the way to go.

Thank you very much.
Steve :)
Jul 20 '05 #3
In a flash of pure inspiration, Lasse Reichstein Nielsen declared:

setInterval(function(){testLocation(parent.frames['main'].location);},1000);

I can't seem to be able to call my function in a page in a different frame.

http://www.leicesterchurchmusic.org/index.html shows my frame definitions
and the function GetPageName(), which works fine. From within this function
I'm trying to call a function in 'top.html' that exists in the frame called
'top'. I'm doing this:

function GetPageName() {
strFullPath = new String(parent.main.location);
arrayJustFileName = strFullPath.split("/");
strFileName = arrayJustFileName[arrayJustFileName.length-1];
arrayName = strFileName.split("."); //0 element is just the name
window.parent.top.test(arrayName[0]);
return arrayName[0];
}

http://www.leicesterchurchmusic.org/top.html contains the function test().
Here it is:

function test(page) {
alert(page);
}

When this function exists in the same document it works fine, but not when I
move it to another one. What am I doing wrong?

Thanks,
Seve :)
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
1
by: Asapi | last post by:
1. Are linkage convention and calling convention referring to the same thing? 2. Does calling convention differ between languages C and C++? 3. How does calling convention differ between...
19
by: Ross A. Finlayson | last post by:
Hi, I hope you can help me understand the varargs facility. Say I am programming in ISO C including stdarg.h and I declare a function as so: void log_printf(const char* logfilename, const...
3
by: Scupper | last post by:
I am working on adapting a process currently handled by VBA functions in a Word template, moving to a VB.NET app that calls Word only when necessary to manipulate documents (essentially, it is...
2
by: Daniel Lidström | last post by:
I'm using a library called fyba. This library reads and writes files in a format called sosi. fyba uses the following code to determine if the calling process has own methods to handle errors,...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
4
by: Edwin Gomez | last post by:
I'm a C# developer and I'm new to Python. I would like to know if the concept of Asynchronous call-backs exists in Python. Basically what I mean is that I dispatch a thread and when the thread...
10
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a...
1
by: Martin Rubey | last post by:
Dear all, I'm trying to call from common lisp functions written for Sage (www.sagemath.org), which in turn is written in python. To do so, I tried...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.