Click to See Complete Forum and Search --> : Delay!


alexthomas
02-27-2003, 07:11 AM
Is there any way you can delay when a fuction is loaded say for 1second?

Basicaly what i would like to do is, i hame six frames, each frame contains 1 page that calls a number of other pages with the use of an array. My problem is i would like to have the frames loading one after each other for example

frame1 - page1 0secs
frame2 - page1 1secs
frame3 - page1 2secs
:
:
frame6 - page1 5secs
frame1 - page2 6secs
frame2 - page2 7secs
:
:
:
frame6 - pagen nsecs

Therfore i need to delay the start of the count by 1 secs for frame2/page1, 2 ses for frame3/page1, so on and so on. Is this possible? if so how?

here is an exapmle of my code:

<html>
<head>
<script language=JavaScript>
<!--
var frame_array = new Array();

frame_array[0] = "frame2a.htm";
frame_array[1] = "frame2b.htm";
frame_array[2] = "frame2c.htm";

var frame_count = -1;
function init()
{
frame_count++;
if (frame_count >= frame_array.length) frame_count = 0;
window.main.location.href = frame_array[frame_count];
setTimeout("init();",6000);
}
// -->
</script>
</head>
<frameset rows="100%,*" border=0 onLoad="init();">
<frame name=main src=0.htm scrolling=no noresize>
</frameset>
</html>

Thanks in advance :)

AL

Charles
02-27-2003, 08:07 AM
But then the internet might rout your first page around the world but not your second page. You will want to make use of each page's onunload handler. And you will want to make sure that your page will still work when there is no JavaScript.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
<!--
document.write('<frameset cols="*,*,*"> <frame src="test1.html"> <frame src=""> <frame src=""> <noframes> <a href="linkFreeVersion.html">Link Free Version</a> </noframes> </frameset>');
// -->
</script>
<noscript>
<frameset cols="*,*,*">
<frame src="test1.html">
<frame src="test2.html">
<frame src="test3.html">
<noframes>
<a href="linkFreeVersion.html">Link Free Version</a>
</noframes>
</frameset>
</noscript>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
<!--
onload = function () {if (top.document.frames[1]) setTimeout ('top.document.frames[1].location = "test2.html"', 1000)}
// -->
</script>
<title>Test 1</title>
<h1>Test 1</h1>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
<!--
onload = function () {if (top.document.frames[2]) setTimeout ('top.document.frames[2].location = "test3.html"', 1000)}
// -->
</script>
<title>Test 2</title>
<h1>Test 2</h1>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Test 3</title>
<h1>Test 3</h1>

alexthomas
02-27-2003, 08:20 AM
Its not going live on the internet