473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

(Javascript) calling user requested div content to another div?

I am re-designing a website which currently makes use of Frames. (I want to replace them with something more convenient.)

It has a layout page, a menus frame and content frame for various content pages (also a links frame.)

What I want to do is make the site completely dynamic. As in, I want to keep the layout, content, menu and links areas in separate files so that updating is easy. Or at least separate the layout from the content so that changing it only needs to be done on one page

Here is an image to make the layout clearer:

http://img520.imageshack.us/img520/4465/layoutic8.gif

I looked into using PHP, made an index page and menus.php include page and put divs instead of Frames, but it all started to look too uncessecarily complicated using an IF/Case statment with the GET variable function.

Plus, it requires a page refresh before any content is even loaded...

The problem was with using includes, I would need to repeat the layout code with the content.

I require a situation that when the user clicks a menu in the menus div the content would be produced for the right page in the content div. (Almost like an Ajax application yet possibly with a page refresh.) The menus area could even be on the same page as the layout.

I read in a search that Javascript was a better way to achieve this. I can't really use Ajax though, the host does not support it.

I am really surprised that I cannot not find a more benifitial way to do this without Frames...

If anyone can suggest how I can achieve this it would be gladly appreciated.

I hope if anyone can provide an answer, this will come up in a search if people are looking for similar things too.
Oct 15 '07 #1
5 1754
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Do you need to get the content of the content div from the server? If not, you could have all the divs on the page, but hidden except the default one. When a link is clicked, the current one is hidden and the div corresponding to the link is shown.

You can use style.display set to 'block' and 'none' to show and hide.
Oct 15 '07 #2
Thank you for the welcome.


This seems like it could work, but I think that suggests the user would have to load all the site content on the first page...

Maybe it would be better if I asked the same question for a PHP solution again.
Oct 15 '07 #3
acoder
16,027 Expert Mod 8TB
What do you mean when you say you can't use Ajax? If you can use PHP, you should be able to use Ajax.
Oct 15 '07 #4
I thought I needed ASP support, for some reason.

Nevermind, in this case would it be easier to do in Ajax and are there any tutorials I could follow that would allow me to set up this calling system from menu to content?
Oct 15 '07 #5
acoder
16,027 Expert Mod 8TB
See this example - the example server-side language is ASP, but it can easily be replaced with PHP.

Also check out the Ajax tutorial links in Offsite Links.
Oct 15 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: MartinRinehart | last post by:
I can load a dialog by loading an HTML page or by constructing the dialog with JavaScript. What should I be thinking about when I look at this choice?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.