Funbrain - ROKR E6 - Myspace Layouts - Air Force One Shoes - Reference And Education Articles

PDA

View Full Version : Link on Iframe should change div on page


media12
Jun 14th 2007, 4:08 am
I have a page where I load an iframe and in that iframe, i have an onclick that looks like this

onclick="javascript:ajaxpage('http://localhost/project/includes/php/add-images.php?src=" . $oname . "&dsc=" . $dsc . "', 'add-images');"

The problem is that the "add-images"-DIV is not in the iframe, it's on the page that loads the iframe, are there any way to make this work, or do I have to find another way of doing it?

Thanks in advance!

krt
Jun 14th 2007, 4:25 am
You need to set the target to the iframe.

To be of more help, I need the code for the ajaxpage() function.

media12
Jun 14th 2007, 5:18 am
Here's that function:

function ajaxpage(url, containerid) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}