Jump to content

Using js to load HTML pages into a DIV


Recommended Posts

I am very new to JavaScript and was wondering if I can accomplish what I want to do using it. I have a single HTML page setup with CSS DIVs. I have a main "content" DIV where I want to display another HTML page, when a button is clicked. Basically, I want to use one "main" HTML page to display the content (in its "content" DIV) of another smaller HTML page, depending on a button action; is this something that can be done using CSS and JavaScript, or will I have to resort to using frames?


Thanks so much for any help you can offer!



Link to comment
Share on other sites

Whatever you do, don't use frames!!!!


There are absolutely no drawbacks to displaying the same parts of a website - like navigation, header, footer, etc. - on every page. If you want to make your maintenance easy, use PHP includes for those parts that will appear on every page

Link to comment
Share on other sites

Thanks Andrea and Eric!


I worked a little bit with PHP before when I took a continuing ed course, but I'm not sure I can go that route because I will not have access to the server (isn't PHP server side only?) and I also do not have access to any database on the server where this web site is going to reside. I have heard about jQuery, but not sure if that is a viable solution unless I doesn't require access to the server and/or a database. Eric, does jQuery require a database, or can you simply use it to call HTML files?


Thank you both for you help!

Link to comment
Share on other sites

Thanks Benjamin! I know nothing about jQuery, so I'll need to do a little homework, but it sounds like this might be the way to go. The only other hurdle I have to ensure that this all works on IE 6 and IE7, because those are the only browsers that the company I work for support. I have tried to convince them to skip IE7 and go directly to 8, which would make my development a LOT easier, but they have not tested 8 and therefore will not be installing it on the company PCs. So, my last question is, will the "hiding/showing" divs (layers) work in IE6 & 7, because I thought I had read a while back that it doesn't. :/ If it doesn't, is there some kind of work around that may be available to get it to work?


Thanks so much - you have all been so helpful!


Candee :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...