Importing javascript functions from an iframe

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Timmy

    #1

    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>
  • -Ema-

    #2
    Re: Importing javascript functions from an iframe

    Timmy wrote:[color=blue]
    > 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[/color]
    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-

    Comment

    • @SM

      #3
      Re: Importing javascript functions from an iframe



      Timmy a ecrit :[color=blue]
      >
      > 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.[/color]

      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' )">

      [color=blue]
      >
      > 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>[/color]

      --
      ******** (enlever/remove [OTER_MOI] du/from reply url) *******
      Stéphane MORIAUX : mailto:stephane OTER_MOImoriaux @wanadoo.fr
      Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)

      *************** *************** *************** *************** **

      Comment

      Working...