This is my first post im (very) new to the world of php and im guessing its a fairly easy problem to sort out. I know a bit of HTML/javascript but i've been trying to fig out how to vary iframe content by URL. For example "http://mysite.com/page11.html?&iframe=page12.html" so that the iframe on page 11 would contain page 12. The script ive been using to get this to work is :
Code: Select all
<script type="text/javascript">
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
function gup( name ) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
addLoadEvent(function() {
var targetURL = gup("iframe");
document.all.myIframe.src=targetURL;
})
</script>Problem is this script only seems to work in IE not FF. From what little i know about PHP it seems like this would be easy to do but i have no idea how. I read that you can make a php page containing
Code: Select all
<iframe src="<?php echo $_GET["iframe"]; ?> name="iframe" id="iframe" width="100%" height="320" scrolling="no" frameborder="0">fail</iframe>I tried this and called the page 'apge11.php' and put in the url : http://mydomain.com/page11.php?iframe=page12.php but didnt work
can anyone help?
Thanks in advance.
Matt