Lleoun
05-06-2009, 11:37 AM
Hi all,
I have the script below (lend by one of the geniuses of this wonderful community) and as you'll see it reloads the page products.php every 3 seconds without any visitor noticing it. Simply wonderful.
Now the problem:
products.php contains divs with information, but it also contains an iframe. The iframe is calling an URL that displays videos.
When products.php is reloaded the information changes (is coming from a xml file) and the iframe contents are also reloaded which causes the video stream to blink every 3 seconds.
Therefore, the iframe should not be reloaded.
What can I do, how should I modify the script to reload everything inside of products.php but the iframe???
Thanks a ton in advance!
<script type="text/javascript">
function getHTTPObject() {
var request = false;
try {
request = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (err2) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (err3) {
try {
request = new XMLHttpRequest();
}
catch (err1)
{
request = false;
}
}
}
return request;
}
var ajaxRequest = getHTTPObject(); // create HTTP Object
setInterval(getPage, 3000); // 3 seconds
function getPage() {
ajaxRequest.open("GET", "products.php", true);
ajaxRequest.onreadystatechange = showPage;
ajaxRequest.send(null);
}
function showPage()
{
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('showit');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
window.onload=function(){
getPage();
}
</script>
<div id="showit"></div>
I have the script below (lend by one of the geniuses of this wonderful community) and as you'll see it reloads the page products.php every 3 seconds without any visitor noticing it. Simply wonderful.
Now the problem:
products.php contains divs with information, but it also contains an iframe. The iframe is calling an URL that displays videos.
When products.php is reloaded the information changes (is coming from a xml file) and the iframe contents are also reloaded which causes the video stream to blink every 3 seconds.
Therefore, the iframe should not be reloaded.
What can I do, how should I modify the script to reload everything inside of products.php but the iframe???
Thanks a ton in advance!
<script type="text/javascript">
function getHTTPObject() {
var request = false;
try {
request = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (err2) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (err3) {
try {
request = new XMLHttpRequest();
}
catch (err1)
{
request = false;
}
}
}
return request;
}
var ajaxRequest = getHTTPObject(); // create HTTP Object
setInterval(getPage, 3000); // 3 seconds
function getPage() {
ajaxRequest.open("GET", "products.php", true);
ajaxRequest.onreadystatechange = showPage;
ajaxRequest.send(null);
}
function showPage()
{
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('showit');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
window.onload=function(){
getPage();
}
</script>
<div id="showit"></div>