Refresh iframe
-
How to refresh iframe in php ? I have 4 iframe in my php and want to refresh all.Example:- <div id="l1" style="position:absolute;left:50px;top:120px;width:450px;height:140px;z-index:35" align="left"><iframe frameborder=0 src="http://ck.com/ker.php?scrip=echo $us" width=412 height=160</frame>/div>
-
How to refresh iframe in php ? I have 4 iframe in my php and want to refresh all.Example:- <div id="l1" style="position:absolute;left:50px;top:120px;width:450px;height:140px;z-index:35" align="left"><iframe frameborder=0 src="http://ck.com/ker.php?scrip=echo $us" width=412 height=160</frame>/div>
I'm very confused. Do you want to refresh the
iframe
's during run-time i.e. after the page has loaded? Because I do not see how you can do that with PHP, it would have to be Javascript. The only possible time you can use PHP is before the page has loaded, in which case it would be pointless as the iframe would be loaded anyway. Everything after the page load has to be done with Javascript. Here is how to refresh the iframe in Javascript:document.getElementById('iframe1').contentWindow.location.reload(true);
If at first you don't succeed, you're not Chuck Norris.
-
I'm very confused. Do you want to refresh the
iframe
's during run-time i.e. after the page has loaded? Because I do not see how you can do that with PHP, it would have to be Javascript. The only possible time you can use PHP is before the page has loaded, in which case it would be pointless as the iframe would be loaded anyway. Everything after the page load has to be done with Javascript. Here is how to refresh the iframe in Javascript:document.getElementById('iframe1').contentWindow.location.reload(true);
If at first you don't succeed, you're not Chuck Norris.
Thanks for your help.I want to refresh iframe after loading page and after every 1 minute.If it is not possible in php then can you tell how to insert java script function in php for refreshing iframe.If you can try to give me a very short example. Thank You
-
I'm very confused. Do you want to refresh the
iframe
's during run-time i.e. after the page has loaded? Because I do not see how you can do that with PHP, it would have to be Javascript. The only possible time you can use PHP is before the page has loaded, in which case it would be pointless as the iframe would be loaded anyway. Everything after the page load has to be done with Javascript. Here is how to refresh the iframe in Javascript:document.getElementById('iframe1').contentWindow.location.reload(true);
If at first you don't succeed, you're not Chuck Norris.
-
Thanks for your help.I want to refresh iframe after loading page and after every 1 minute.If it is not possible in php then can you tell how to insert java script function in php for refreshing iframe.If you can try to give me a very short example. Thank You
udch wrote:
If it is not possible in php then can you tell how to insert java script function in php for refreshing iframe.
Your statement shows a clear lack of understanding about how HTML, PHP and Javascript work. In the below example you can see how to use PHP with HTML correctly. You can see that the HTML tags are not written in PHP. The only part of this page that is affected by PHP is the body which will have 'Hello World!!' written in it. Also see how the Javascript is in the
<script></script>
tags. Make sure you give thetype
of the script block which in this case will betext/javascript
. Your Javascript functions will now go in the script tags, as shown. Notice that in the functionrefreshIframes()
there is asetTimeout()
function which calls the function given as the first parameter ('refreshIframes()'
in this case) and the number of milliseconds to wait for it to call as the second parameter (60000
in this case [60 seconds]). Please also note thatonload="refreshIframes()"
is in thebody
tag, this calls therefreshIframes()
function once the page has loaded.<html>
<head>
<title>Hello World</title>
<script type="text/javascript">
function refreshIframes()
{//THE CODE I GAVE YOU EARLIER WILL GO HERE! setTimeout('refreshIframes()', 60000); } </script>
</head>
<body onload="refreshIframes()"><? echo 'Hello world!!'; ?> <!-- INSERT IFRAME HERE! -->
</body>
</html>If at first you don't succeed, you're not Chuck Norris.