gabrola
10-25-2008, 10:37 PM
I need a function that will reload a page inside an iframe a number of times.
Example.
There is a form that has 1 input box and a button so I enter 10 in the box and click the button then for example a certain page will reload 10 times inside the iframe.
I was able to do that but the problem is i can't set it to wait for the page to load first, secondly i want it to reload the page as soon as the first part loads not the whole of it.
Thanks and please help
Here's my code
<script type="text/javascript">
var t = 0;
function StartRefresh(){
e = t;
if(t == document.form.how_many.value) {
counter.innerHTML="Finished";
} else {
t += 1;
counter.innerHTML=t;
document.getElementById('refreshed').src = 'example.com';
}
}
</script>
<FORM NAME="form">
# of Times?<INPUT TYPE="text" name="how_many"><br>
<br>
<INPUT TYPE="button" VALUE="Start" onClick="StartRefresh()">
<span id="counter"></span>
<iframe id="refreshed" height="100px" align="left" width="100px" frameborder=0 marginwidth=0 marginheight=0 src=""></iframe>
</FORM>
using settimout or setinterval will make it wait for a specified amount of time and i don't want that I want it to reload as soon as the page starts to reload
Example.
There is a form that has 1 input box and a button so I enter 10 in the box and click the button then for example a certain page will reload 10 times inside the iframe.
I was able to do that but the problem is i can't set it to wait for the page to load first, secondly i want it to reload the page as soon as the first part loads not the whole of it.
Thanks and please help
Here's my code
<script type="text/javascript">
var t = 0;
function StartRefresh(){
e = t;
if(t == document.form.how_many.value) {
counter.innerHTML="Finished";
} else {
t += 1;
counter.innerHTML=t;
document.getElementById('refreshed').src = 'example.com';
}
}
</script>
<FORM NAME="form">
# of Times?<INPUT TYPE="text" name="how_many"><br>
<br>
<INPUT TYPE="button" VALUE="Start" onClick="StartRefresh()">
<span id="counter"></span>
<iframe id="refreshed" height="100px" align="left" width="100px" frameborder=0 marginwidth=0 marginheight=0 src=""></iframe>
</FORM>
using settimout or setinterval will make it wait for a specified amount of time and i don't want that I want it to reload as soon as the page starts to reload