By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,819 Members | 2,073 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,819 IT Pros & Developers. It's quick & easy.

Hi, I want to read html files from a html file.

P: n/a
I have 5 html files say

file1.html
file2.html
:
:
file5.html
Now I have another html file (main.html) where I want to use 1 html
file at a time but I want to read all of them. Like when this main html
loads it calls file1 and executes it then calls file2....then 3 till
file 5.

How do I use js. I need a js function to do this.
Thanks

Sep 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

D`Jinn Deegee wrote:
I have 5 html files say

file1.html
file2.html
:
:
file5.html
Now I have another html file (main.html) where I want to use 1 html
file at a time but I want to read all of them. Like when this main html
loads it calls file1 and executes it then calls file2....then 3 till
file 5.

What do you mean when you write " it calls file1 and executes it "?
HTML files are not things you can execute. Did you mean these were JS
files? Or by "execute" did you mean simply "show". How do you want
these different files to show up?

If you mean show, one way you could do this would be with AJAX calls,
and the easiest way to achieve that would be using someone else's
library. I prefer to use Prototype. This is what I did on my dad's site
to keep photo captions in sync with the photos being displayed. You can
see what I mean here:

http://www.ralphkrubner.com/Commercial/

Click the "Next" button a few times. An AJAX call updates the caption
each time a new image appears. Is that the effect you are going for?

Sep 18 '06 #2

P: n/a
D`Jinn Deegee wrote:
I have 5 html files say

file1.html
file2.html
:
:
file5.html
Now I have another html file (main.html) where I want to use 1 html
file at a time but I want to read all of them. Like when this main html
loads it calls file1 and executes it then calls file2....then 3 till
file 5.

How do I use js. I need a js function to do this.
So what it sounds like you want to do is
have a couple of main.html files that
insert those other HTML files as shared content.

There are different ways to do this.
You could use AJAX to fetch the pages
and it's related load event.

You could also use a hidden frame and an onload event

In either case the event callback function you make would
move the resulting html data to a div in your page.

There are some other ways too if you don't like these
Sep 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.