Results 1 to 3 of 3

Thread: iframe url display

  1. #1
    Join Date
    May 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question iframe url display

    1) Script Title: Random iframe content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndomiframe.htm

    3) Describe problem: I want to display the URL of the page displayed

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Here in the script:

    Code:
    iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
    Is where it sets the src attribute of the iframe. If you had - say a link or other element that you wanted to have display the url, you could do this:

    Code:
    el.innerHTML=iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
    You would need to define el earlier in the script though - before the code executes and after the browser parses the element. So,you could put a span on the page before the script:

    HTML Code:
    <span id="urlholder"></span>
    Then at the beginning of the script define it:

    Code:
    var el=document.getElementById('urlholder');
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    John, thanks for the details on how to solve this problem. For the time being I am going to stick to the URL button that opens the viewed page, and see what kind of a response I get. Your new code for backing up within the frame could change that decision. Here is the current layout: http://www.kabubble.com/pingxit_news.htm.

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
  •