So you want to display different content in the iframe below depending on what link they click in the top navbar?
Here's your main page that contains the iframe:
Code:
<html>
<head>
<title>Main page</title>
<script>
function loadIframe(iframeName, url) {
if ( window.frames[iframeName] ) {
window.frames[iframeName].location = url;
return false;
}
return true;
}
</script>
</head>
<body>
<a href="iframepage.php?id=1" onclick="return loadIframe('myiframe', this.href)">Page 1</a> |
<a href="iframepage.php?id=2" onclick="return loadIframe('myiframe', this.href)">Page 2</a> |
<a href="iframepage.php?id=default" onclick="return loadIframe('myiframe', this.href)">Default</a>
<br>
<br>
<iframe src="iframepage.php?id=default" name="myiframe" id="myiframe" width="800" height="800"></iframe>
</body>
</html>
Here's your iframe page that loads a different url, depending on the top nav bar link that was clicked:
Code:
<?php
if($id = $_GET['id']) {
// great
} else {
$id = 'default';
}
switch($id) {
case '1':
//echo "It's 1";
header("Location: http://www.wormgush.com/", true, 301);
break;
case '2':
//echo "It's 2";
header("Location: http://www.eelsoup.net/", true, 301);
break;
default:
//echo "Default";
header("Location: http://www.nutabuse.com/", true, 301);
break;
}
?>
You can see that the main page contains a javascript function that loads a new version in the iframe.
The iframe page takes a $_GET argument and allows you to load a different url depending on which $_GET variable you append to the iframe url.
Bookmarks