Importing javascript functions from an iframe

T

Timmy

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>
 
E

-Ema-

Timmy said:
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-
 
@

@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"

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:[email protected]
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
**************************************************************
 

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
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top