NameSilo

Linking to another page and opening a specific document into an IFRAME

Spaceship Spaceship
Watch

makermet

New Member
Impact
0
Hi there...

I'm having some trouble figuring out how to set this up:

Basically, I want to be able to have a link on "page1", that links to "page2". On page2 there is an IFRAME. When page2 opens, I want a specific document loaded into the IFRAME, not the default one stated in the src property of the IFRAME tag.

I'm guessing I'd somehow need to put a variable into the link URL that is passed to the new document, then the variable (the document name to be loaded into the IFRAME) is passed onto the IFRAME.

Anybody have any idea how to do this?

Thanks in advance.

sorry: this has been sorted now. thanks.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
If you have access to some server side language like ASP then this is easy

-- link --
HTML:
link.com/default.asp?fsrc=apage.htm
-- page source --
HTML:
<iframe src="<%=request("fsrc") %>">

If not then using javascript is the next step which is somewhat trickier.

HTML:
// as part of the header
function loadframesrc(){
var URL = unescape(window.document.location);
if (URL.indexOf("?") > -1) { 
//whether the location contains a "?" or not
var list1 = URL.split("?");
//split at "?";
var list2 = list1[1].split ("=");
//split at "=";
var theurl = list2[1];
//assignment
document.frames['framename'].location.href = theurl 
}
}

then you need to add the following to the body tag.

<body onload="loadframesrc()">

Untested but something like the above would work as long as its the first variable pair in the url.
 
0
•••
Appraise.net

We're social

Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back