PDA

View Full Version : Iframe refresh does not work in my webpage



Vaonline
01-31-2012, 06:06 PM
Hello!
Well, exactly in this forum i found (at last!) the iframe refresh code that i was searching for:


<script type=text/javascript>
function refresh()
{
document.all.a3c0f84d.src = document.all.a3c0f84d.src;
}
window.setInterval("refresh()",10000);
</script>

Of course, the id of my Iframe is "a3c0f84d".
I succefully used this code in: http://codigoindex.es.tl/ just to see that it works.
But in my other webpage, i have 3 of these iframes with same id and they never reload, despite i put the javascript code in head or body, but nothing happens.

Can someone help me with this? Thanks a lot.

molendijk
01-31-2012, 09:21 PM
Your code is outdated. Use:
document.getElementById('a3c0f84d').src = document.getElementById('a3c0f84d').src

You should not use one and the same ID for more than one element. So each of the iframes should have its own ID.
===
Arie Molendijk.