473,322 Members | 1,699 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,322 software developers and data experts.

How to make the iframe's to call my function remotely?

i am trying to disable some of the anchor tags which are linked with particular onmouseover and onmouseout events.i have written a javascript function.when i called this function on load of the document body, it is able to disable the tags.But when the body of the page has iframes, this script is unable to disable the tags with in the iframes. since "document.getelemetbytags" is not returning the anchor tags with in the iframe.so i need to put this script in the iframe source file and i need to call this function on load of the body of the iframe. since my site has so many iframes i would need to repeat this task so many times.

Without even including the script in the iframe source file, and the below code on all the iframe tags,

onload=javascript:linkdisabling function();

is there any way to make the iframes to call and access this function onload ?

please notify me if my question is unclear .
Feb 15 '09 #1
6 2616
gits
5,390 Expert Mod 4TB
in your iframe's onload just call something like that:

Expand|Select|Wrap|Line Numbers
  1. parent.disable_my_nodes(document);
  2.  
so just pass the document to the function and note that the shown example works when the iframe is a direct child of your document ... otherwise you may use top or parent.parent for example.

kind regards
Feb 15 '09 #2
This code works very well, Thanks alot for the reply.

but i still have a probelm in implementing this.
My Web site has large number of iframes, and the content of the iframe starts in one file and ends in another file,so inserting a body tag and an onload method in the body tag becomes a bit difficult. hence i thought of inserting the below javascript to all my iframes , but it does not work.
Expand|Select|Wrap|Line Numbers
  1.   <script type="text/javascript">
  2.              document.body.onLoad = link disabling_function (document) {
  3.                 function body
  4.             }
  5.         </script>
  6.  
help me to spot the problem in this script.
Is there any other way to make this function to be called onload of the iframe content.
Feb 16 '09 #3
gits
5,390 Expert Mod 4TB
i don't get it ... could you give a simplified example for the structure you are using? one page, one iframe with it's example content, and how yuo use the javascript code in it? this should make it clear where the problem would be.

kind regards
Feb 16 '09 #4
To make my iframe to access my javascript function i thought of inserting the below tag in my iframes.
<body onload="link disabling_function (document) ;">
</body>
but most of my iframe's content starts in one file and ends in another file,
hence to insert a body tag for an iframe i require to change two files for an iframe.
Hence without doing this if i thought of including the below script in all iframe's content.
<script type="text/javascript">
document.body.onLoad = link disabling_function (document)();
</script>

But the script does not work.

Please help me to make the script work, or suggest me a method , to call this function [link disabling_function]onLoad of the iframe.
Feb 17 '09 #5
i would like to know, if there is any other method ,which would make my iframes to call my function onLoad, with out even inserting anycode in the iframe content.
Feb 17 '09 #6
gits
5,390 Expert Mod 4TB
are all iframes-contents from your domain and does they not! have an onload already?
Feb 17 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Wendi | last post by:
If i have an iframe from within an HMTL document: Iframe.htm: ------------------------------ <html> <head> <title>Iframe.htm</title> </head> <body> <iframe src="sample.htm"></iframe>
2
by: Gunther Radick | last post by:
Let's say I've an IFRAME on a page, with an ID of "myFrame". If I call - myFrame.document.write( "Something" ); the "Something" gets written to the IFRAME, as expected, but the browser (and...
6
by: Razzbar | last post by:
I've written several utility pages that use a dynamically created iframe. The iframe typically has a form that is populated by the main page. Then the form is submitted to be processed, and the...
26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
4
by: Laphan | last post by:
Hi The god that is Martin Honnen gave me a great tip to DOM/JS some HTML data into an iframe, but I need to make sure that the iframe is ready to take it before I paste it in. At the moment,...
1
by: Z1P2 | last post by:
I would like to gradually resize an iframe in an onmouseover event. I can easily do it with an image, but when I try to do it with an iframe, it doesn't do anything. So first of all, is it possible...
1
by: SunshineInTheRain | last post by:
My project has 3 files, File1 has included master page. file1 consists of iframe1 that load file2. File2 consists of iframe2 that load file3. Javascript used on each file to resize the iframe...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.