How to display several web page with loop

D

dovelet

Hi all,

I am new in javascript and I hope someone can help me. I would like to
write a web page with 2 frame, left and right. When browse the web
page, it will read a file from the hard disk. The file format is as
follow:

a.html
b.html
c.html

The left hand side will display all these filename. The right hand
side will browse these web pages one by one with loop (i.e. a.html ->
b.html -> c.html -> a.html ...). Can anyone teach me how to do this?
Many thanks.

Regards,
Dovelet
 
M

MyndPhlyp

dovelet said:
Hi all,

I am new in javascript and I hope someone can help me. I would like to
write a web page with 2 frame, left and right. When browse the web
page, it will read a file from the hard disk. The file format is as
follow:

a.html
b.html
c.html

The left hand side will display all these filename. The right hand
side will browse these web pages one by one with loop (i.e. a.html ->
b.html -> c.html -> a.html ...). Can anyone teach me how to do this?

You don't need JavaScript to do that. In the pages that will loop on the
right side, include two lines in the <head> section:

<base target="_self">
<meta http-equiv="refresh" content="1;url=X.html">

where X in the url is "b" for the "a" page, "c" for the "b" page, and "a"
for the "c" page. The "1" calls for a 1-second delay.

It should work for any browser that respects the HTTP-EQUIV meta tag.

Probably not what you are looking for, but I just had to throw that out
there as a possibility.
 
D

Dovelet

Hi MyndPhlyp,

Thanks of your reply. However, as the web pages "a.html", "b.html" &
"c.html" are not owned by me, I cannot add some header in these pages.
Do you or someone have any ideas? Thanks.

Regards,
Dovelet
 
E

Evertjan.

Dovelet wrote on 31 dec 2004 in comp.lang.javascript:
Thanks of your reply. However, as the web pages "a.html", "b.html" &
"c.html" are not owned by me, I cannot add some header in these pages.
Do you or someone have any ideas? Thanks.

so you are realy talking about another domain's pages?


<body style='margin:0;'>
<iframe id=ifr style='width:100%;height:100%;'></iframe>

<script type='text/javascript'>
var i=0
var ifr=document.getElementById('ifr')

function f(){
if (i==0) ifr.src="http://otherDom.com/a.html"
if (i==1) ifr.src="http://otherDom.com/b.html"
if (i==2) ifr.src="http://otherDom.com/c.html"

i++
if (i>2)i=0
setTimeout('f()',5000)
}
f()

</script>

IE6 tested
 
D

Dovelet

Hi Evertjan,

It is work! Thanks.

Dovelet

Evertjan. said:
Dovelet wrote on 31 dec 2004 in comp.lang.javascript:

so you are realy talking about another domain's pages?


<body style='margin:0;'>
<iframe id=ifr style='width:100%;height:100%;'></iframe>

<script type='text/javascript'>
var i=0
var ifr=document.getElementById('ifr')

function f(){
if (i==0) ifr.src="http://otherDom.com/a.html"
if (i==1) ifr.src="http://otherDom.com/b.html"
if (i==2) ifr.src="http://otherDom.com/c.html"

i++
if (i>2)i=0
setTimeout('f()',5000)
}
f()

</script>

IE6 tested
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top