Results 1 to 4 of 4

Thread: Targeting the Floating Frame

  1. #1
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Targeting the Floating Frame

    Hi,
    I want to say how easy it was to implement your floating frame script... very straight-forward.

    I'm having trouble, however, to target that IFrame ("masterdiv") with a <AHREF..>

    Briefly, I have a list of people that when clicked on, their picture *should* load into this IFRAME, and replace the "temporary.htm" page I've put into it as a placeholder.

    The picture loads .. but it replaces the page completely ..not IN the IFRAME ???

    Here's the chunk of HTML code:

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

    <a href="<%=PICurl%>" OnClick="javascript:changePic()" class="docs"><img src="../img/EMPpic.jpg" border="0"></a>


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

    and Here's the chunk of Javascript code:

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

    <script>
    function changepic(){
    parent.document.getElementById("masterdiv")
    }
    </script>

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

    I think it has to do with my DOM stucture...

    Please advsie,
    Thanks
    nancy

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question., in this case, http://www.dynamicdrive.com/dynamici...loatiframe.htm

    Try the below function:
    Code:
    <script type="text/javascript">
    function changepic(picsrc){
    parent.document.getElementById("masterdiv").Document.body.innerHTML='<img src="'+picsrc+'">'
    }
    </script>
    
    <a href="javascript:changepic('dog.gif')">Change picture</a>
    Last edited by ddadmin; 04-26-2005 at 09:02 PM.

  3. #3
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Targeting a Floating IFRAME

    Related Topic:
    http://www.dynamicdrive.com/dynamic...floatiframe.htm


    I've solved the problem, quite simply frankly...
    Here's the code that fixed the problem:

    <a href="<%=PICurl%>" target="masterdiv" .... >

    I targeting the name of my floating frame and Voila!

    Thanks all for your help,
    nancy

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    LOL why didn't I think of the "target" attribute?

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
  •