Welcome to TalkGraphics.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2010
    Posts
    6

    Default Calling function in iframe

    I have an iframe which beside other script has a function called buttonMap(number) which runs some code. I would like to call the function with different values using buttons outside of the iframe. (I don't want to reload a page each time).
    Can this be done? For simplicity lets say the iframe has id="showMap".
    In my naive way I was thinking that I could link a xara button in web properties as for instance: javascript:showMap.buttonMap(2).
    I realise this won't work (have tried it) but is it possible to call a function in an iframe from xara?
    Any help would be appreciated.
    Thanks
    Bob

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,503

    Default Re: Calling function in iframe

    Welcome to TalkGraphics Bob

    Someone will answer this shortly.

  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,823

    Info Re: Calling function in iframe

    Quote Originally Posted by BobJohnson View Post
    javascript: getElementById('showMap').buttonMap(2); .
    Try this that I edited from your go.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #4
    Join Date
    Nov 2010
    Posts
    6

    Default Re: Calling function in iframe

    Many thanks. Without your help I would still be struggling. Needed a bit of tweaking.
    Final solution from example is:

    javascript: document.getElementById("showMap").contentWindow.b uttonMap(2);

    Again - thank you very much
    Bob

  5. #5
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,823

    Default Re: Calling function in iframe

    Quote Originally Posted by BobJohnson View Post
    Many thanks. Without your help I would still be struggling. Needed a bit of tweaking.
    Final solution from example is:

    javascript: document.getElementById("showMap").contentWindow.b uttonMap(2);

    Again - thank you very much
    Bob
    Glad you're there Bob.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •