473,748 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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;visib ility: hidden;">

<script>

function actionMe(action ) {

alert(action);
}
</script +>

<div id="Layer1" style="width:27 6; height:110; visibility: visible;
z-index=3;" onmouseover="ac tionMe('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 2606
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.onmouseov er = function(messag e) {
alert(message);
};
parent.document .appendChild(my div); // 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_Fra me.itsFunction( );
or
top.MyFrame.its Function();

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

so ... with the iframe named "myIframe"

<div id="Layer1" onmouseover="pa rent.myIframe.a ctionMe('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;visib ility: hidden;">

<script>

function actionMe(action ) {

alert(action);
}
</script +>

<div id="Layer1" style="width:27 6; height:110; visibility: visible;
z-index=3;" onmouseover="ac tionMe('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
2214
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 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...
2
2878
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 the time. But every now and then, when I hit the back button, the browser suddenly thinks the Javascript created document in the IFrame is not from the same domain as the topmost document, and therefore I start getting "permission denied" errors...
1
3521
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. The Javascript functions are supposed to redirect the iframe to a new page (different page for each link).
18
43565
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. (It's for Google Maps, but I won't bore you with the complexities of that, as it doesn't affect the question). Mochas kudos to anyone able to solve this widdle.
4
5938
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 document.getElementById("mainDiv").innerHTML = test_iframe.document.body.innerHTML; but this does not seem to carry over the Javascript code from IFrame to
5
9584
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
5213
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 the page. It adds some JavaScript code. The problem is: IE ignores all events and JS is not running... (it happens only on RSS pages... on other pages it works correctly...)
7
2395
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
8983
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9236
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4592
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.