View Full Version : iframe url display
rysmith
11-18-2006, 10:28 PM
1) Script Title: Random iframe content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/randomiframe.htm
3) Describe problem: I want to display the URL of the page displayed
jscheuer1
11-20-2006, 06:03 AM
Here in the script:
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:
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:
<span id="urlholder"></span>
Then at the beginning of the script define it:
var el=document.getElementById('urlholder');
rysmith
11-20-2006, 04:12 PM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.