Forum Moderators: open
Parent Document
<body onload="loadFrames();"><div id="0">
</div><div id="1">
</div><div id="2">
</div><div id="3">
<iframe name="f3" style="width:760px;" src="file.php?id=3" onload="javascript:fixFrame3();"></iframe>
</div><div id="frameHeight"></div>
<script type="text/javascript">
var inner=new Array();
<?php for($c=0;$c<3;$c++): ?>//make 3 iframes
inner[<?php echo $c; ?>]='<iframe name="f<?php echo $c; ?>" style="width:760px;" src="file.php?id=<?php echo $c; ?>" onload="javascript:fixHeight(<?php echo $c; ?>);"></iframe>';<?php endfor; ?>
function loadFrames() {
for(i=0;i<3;i++){
document.getElementById(i).innerHTML = inner[i];
document.getElementById("f"+i).style.height = window.frames[i].document.getElementById("wrap"+i).scrollHeight + "px";
}
}function fixFrame3() {
document.getElementById("frameHeight").innerHTML = window.f3.document.getElementById("wrap3").scrollheight + " px";
}</script>
</body>
file.php
<?php
// get id from src path
$id = $_GET['id'];
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body><div id="wrap<?php echo $id; ?>">
<?php if($id==0): ?>
<img src="http://example.info/images/photo/misc/drink.jpg" />
<?php elseif($id==1): ?>
<img src="http://example.info/images/photo/misc/lunch.jpg" />
<?php elseif($id==2): ?>
<img src="http://example.info/images/photo/circle/log.jpg" />
<?php elseif($id==3): ?>
<img src="http://example.info/images/photo/circle/wooden.jpg" />
<?php endif; ?></div><!-- end wrap -->
</body>
</html>
any thoughts?
[edited by: coopster at 9:13 pm (utc) on Mar. 19, 2009]
[edit reason] please use example.com, thanks! [/edit]