473,324 Members | 2,511 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,324 software developers and data experts.

Importing javascript functions from an iframe

Hi,

I have an iframe src which is a dhtml <div> which includes a
javascript function, what I want to do is appendchild the <div id=xxx>
to the parent webpage, I am able to import and append the image to the
parent page. However the script function does not seem to get
recognized via the browser.

E.g when I go mouseover on the image in the parent page it throws the
error "object expected".

Does anyone know how I can import and execute the scriupt functions
too?

Thanks,

Tim

<div id="xxx" style="position:absolute;visibility: hidden;">

<script>

function actionMe(action) {

alert(action);
}
</script +>

<div id="Layer1" style="width:276; height:110; visibility: visible;
z-index=3;" onmouseover="actionMe('alert')">
<a target="_top" href="http://google.com.au"><img
src="http://www.google.com.au/intl/en_au/images/logo.gif" border=0
height=110 width=276 alt=""></a>
</div>
</div>
Jul 20 '05 #1
2 2590
Timmy wrote:
Hi,

I have an iframe src which is a dhtml <div> which includes a
javascript function, what I want to do is appendchild the <div id=xxx>
to the parent webpage, I am able to import and append the image to the
parent page. However the script function does not seem to get
recognized via the browser.

E.g when I go mouseover on the image in the parent page it throws the
error "object expected".

Does anyone know how I can import and execute the scriupt functions
too?

Thanks,

Tim

Try something like:

var mydiv = parten.document.createElement("div");
mydiv.onmouseover = function(message) {
alert(message);
};
parent.document.appendChild(mydiv); // or wherever you want

-Ema-

Jul 20 '05 #2
@SM


Timmy a ecrit :

Hi,

I have an iframe src which is a dhtml <div> which includes a
javascript function, what I want to do is appendchild the <div id=xxx>
to the parent webpage, I am able to import and append the image to the
parent page. However the script function does not seem to get
recognized via the browser.
seen any iframe in proposed code ...

the usual way to call an external function is :

parent.My_I_Frame.itsFunction();
or
top.MyFrame.itsFunction();

or with a pop-up window named *myPop*
myPop.onePopUpFunction();

so ... with the iframe named "myIframe"

<div id="Layer1" onmouseover="parent.myIframe.actionMe('alert')">


E.g when I go mouseover on the image in the parent page it throws the
error "object expected".

Does anyone know how I can import and execute the scriupt functions
too?

Thanks,

Tim

<div id="xxx" style="position:absolute;visibility: hidden;">

<script>

function actionMe(action) {

alert(action);
}
</script +>

<div id="Layer1" style="width:276; height:110; visibility: visible;
z-index=3;" onmouseover="actionMe('alert')">
<a target="_top" href="http://google.com.au"><img
src="http://www.google.com.au/intl/en_au/images/logo.gif" border=0
height=110 width=276 alt=""></a>
</div>
</div>


--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
Jul 20 '05 #3

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

Similar topics

5
by: lordslayer | last post by:
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...
2
by: Robert Oschler | last post by:
I have an IFrame whose document is created completely by Javascript code at runtime. The document in the IFrame accesses Javascript functions in the top level document. This works fine most of...
1
by: jeff_m | last post by:
Hello all, I'm having an issue with the following: I have an .aspx page with two html links that call distinct Javascript functions. I also have an iframe in the html of this .aspx page....
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: sameergn | last post by:
Hi, I have HTML form whose target is an invisible IFrame. After the IFrame is loaded completely, following code transfers contents of IFrame to DIV ...
5
by: Lupus | last post by:
Hi everyone, I've got a problem with javascript. I have a webpage which contains some javascript functions and an iFrame which contains a second webpage: <html> <head> .... <script....>
3
by: RussianNeo | last post by:
Hi everybody! I've got some problems with JavaScript in IE7... I'll try to describe the situation... I'm writing a toolbar for IE7. After IE loaded the page, the toolbar changes the code of...
7
by: kaer | last post by:
I have to send an XPath request on web page with JavaScript (with XMLHttpRequest) that has to be executed before. I have no idea on how to do that. Any pointer is welcome.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.