Does the frame (iframe or frameset?) on page 2 not already just point to the location? I'm confused on how you have your pages setup... do you have an example or code?
Edit: ok, I re-read it, so you have 1 page, you click on a link, which opens page 2. Page 2 has an iFrame on it, and you want it when you click on the link on page 1, you can define what link opens on page 2? Here you go:
Page 1 link:
Code:
<a href="page2.html?frame=page3.html">Click me!</a>
Page 2 code:
Code:
<html>
<head>
<script>
function geturlArguments() {
var params = new Array();
if (location.search) {
var pairs = location.search.substring(1, location.search.length).split("&");
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split("=");
params[i] = nameVal[1];
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
function loadframe() {
var get = geturlArguments();
document.getElementById("myFrame").src = get["frame"];
}
</script>
</head>
<body onload="loadframe();">
Here is my Frame:
<iframe width="500" height="400" id="myFrame" style="border: 2px black solid">
You have no Frames Support!
</iframe>
</body>
</html>
The JS code will grab the url from the querystring and set the src of the iframe to it. You dig?
Last edited by funkdaddu; 12-06-2005 at 12:36 AM..
|