dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascript dynamically show div and populate contained iframe on button click

  1. #1
    Join Date
    Dec 2009
    Posts
    14

    Cool Javascript dynamically show div and populate contained iframe on button click



    Hello all I am new here but this place looked great and like one of the only places where I could find the answer to my question.

    I have created a page which pulls search results from various sites using PHP. It displays each result in a row in a table upon running.

    I wanted to add a button saying "More information" at which point, a div would appear and load the associated link for that search result within an iframe within the newly appeared div. I've been able to get a div appear and disappear on button click but, I couldn't get it to dynamically load an iframe on click with the associated search results link.

    Any suggestions are greatly appreciated. Also let me know if you need more information before assisting. Thanks!

  2. #2
    Join Date
    May 2009
    Posts
    7

    re

    Not sure why you would want to use an iframe.

    Try researching innerHTML or append.

    Say you have a div on the page with id 'blah'.

    Then you can say document.getElementByID('blah').innerHTML = "yaddayadda";

    The result would be:
    <div id="blah">YaddaYadda</div>

    yaddayadda being the information you imported... (likely using Ajax)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles