GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Feb-2009, 06:29
damy damy is offline
Junior Member
 
Join Date: Aug 2007
Location: Romania,Timisoara
Posts: 51
damy is on a distinguished road

Open something in a div


Hi, I want to know how, if I have a site structured like that, a header div, a menu div in left, and a container div in right, how I do like by clicking a link in the menu div, in container div do be opened a page.

Thank you.
  #2  
Old 07-Feb-2009, 09:44
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Open something in a div


As far as I know, it isn't possible to load the content of an external file inside a div tag (someone please correct me if I'm wrong). All the content that displays in the div tags needs to be there in your page. That being said, you could do something like this:

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Hello!</title> <script type="text/javascript"> function TagSet(numTags, name) { this.numTags = numTags; this.name = name; } TagSet.prototype.showDiv = function(id) { for (var i=0; i<this.numTags; i++) { var tag = document.getElementById(this.name + i); if (tag) { if (i == id) tag.style.display = "block"; else tag.style.display = "none"; } } } var T = new TagSet(3, "foo"); </script> </head> <body> <div id="foo0">Hello!</div> <div style="display: none;" id="foo1">Greetings!</div> <div style="display: none;" id="foo2">Salutations!</div> <a href="javascript:T.showDiv(0)">Show div 0</a><br/> <a href="javascript:T.showDiv(1)">Show div 1</a><br/> <a href="javascript:T.showDiv(2)">Show div 2</a><br/> </body> </html>

I actually used 3 div tags, and I toggle which one is visible. All the variables are encapsulated in a TagSet object so that you can make multiple sets of switchable div tags.

EDIT: Just to clarify, you can easily use PHP to show content from an external file on your page. The problem is that you can't dynamically change what file the content is coming from after the page loads. If you want to go that route, you could use PHP and pass the name of the file to be displayed inside each div tag as parameters. However, you would have to reload the whole page every time you wanted to change the content of one of the divs, and it sounds like you don't want to do that.
__________________
www.blake-foster.com
  #3  
Old 07-Feb-2009, 10:18
damy damy is offline
Junior Member
 
Join Date: Aug 2007
Location: Romania,Timisoara
Posts: 51
damy is on a distinguished road

Re: Open something in a div


No, my ideea is that my site to look like that: http://www.coco243.lx.ro/, and in the content div to display my informations, no others informations, after clicking links from my div menu, I'm a begginer in web design, and I wat to make a simple site with a menu and a right side where to show informations, my informasions structured after my menu. I hope to make myself understanded
  #4  
Old 07-Feb-2009, 10:24
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Open something in a div


You could easily do that with the code I posted, unless I'm misunderstanding something about what you're trying to do.
__________________
www.blake-foster.com
  #5  
Old 07-Feb-2009, 10:35
damy damy is offline
Junior Member
 
Join Date: Aug 2007
Location: Romania,Timisoara
Posts: 51
damy is on a distinguished road

Re: Open something in a div


ok, now I'm studying your code, thanks
  #6  
Old 07-Feb-2009, 10:59
damy damy is offline
Junior Member
 
Join Date: Aug 2007
Location: Romania,Timisoara
Posts: 51
damy is on a distinguished road

Re: Open something in a div


Man!!, another way doesn't exist?, first of all I don't understand the code, it is very complex for me, I think you use javascript but I just have heard about javascript, I'm just want for now a simple site wrote in html and css, is it possible something like that? and second problem is that when I click the link on your menu of your page the informasion is displayed on header, I want like in the right div to be oppened a page from my pages. I don't know if you understand what I want, I don't know very well english, sorry
  #7  
Old 07-Feb-2009, 11:31
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Open something in a div


Does your web host support PHP?
__________________
www.blake-foster.com
  #8  
Old 07-Feb-2009, 11:33
damy damy is offline
Junior Member
 
Join Date: Aug 2007
Location: Romania,Timisoara
Posts: 51
damy is on a distinguished road

Re: Open something in a div


I think that it does, but with css is not possible what I want to do?
  #9  
Old 07-Feb-2009, 11:34
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Re: Open something in a div


That depends. If you need the code that will be in the content div to be in a separate file, then no. If you can put all the code in a single file, then yes it is.
__________________
www.blake-foster.com
  #10  
Old 07-Feb-2009, 11:46
damy damy is offline
Junior Member
 
Join Date: Aug 2007
Location: Romania,Timisoara
Posts: 51
damy is on a distinguished road

Re: Open something in a div


Nasty, then I understand that html and css are unusefull, I wasted my time trying learn them, and I belived that doing web page structured in 3 divs is easy, but..., and to be able to make web pages I have to learn php with no discution?
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Media Player doesn't open Snowman Computer Software Forum - Windows 3 24-Aug-2008 21:34
How to open files outside my program? DeadOverlord C++ Forum 5 30-Oct-2007 21:27
Apache default page can't be visited satimis Apache Web Server Forum 0 05-Apr-2007 05:40
[ANN] New script engine: Open Basic (Basic syntax) MKTMK Computer Programming Advertisements & Offers 0 01-Sep-2005 07:13
[Tutorial] Standard I/O aaroncohn C Programming Language 20 27-Feb-2004 22:07

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:07.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.