Reply
Displaying/Changing content of a div ... a question of possibility.
Old 03-20-2007, 03:03 PM Displaying/Changing content of a div ... a question of possibility.
Novice Talker

Posts: 7
Hi,

new here, and didn't code for a while, actively (back then frames where still standard and I was quite a bit younger ) - been switching to .css now that I have some coding projects again.

I am currently working on a little something for a university assignment (utterly not web design related ... am studying Outdoor & Environmental Education) - it's not even worth a lot of credits, but I want to do it nicely. I wonder if what I am trying to do is possible at all with a CSS layout, however - in any reasonable time frame. ... that is I want to be able to start adding content by tomorrow, if possible.

Here's the basic layout:
http://www.student.ljmu.ac.uk/eclchaeb/rocks/rocksv2

As I only have 750 words for a very complex topic I wanted to expand the text by additional small clickable explanations within it ... that works, obviously (and I am allowed to go up to an infinite wordcount if the main text without opened explanations doesn't exceed the 750 words.

However ... some things just will need more detail to explain - diagrams and the like. That's what I had planned to use the space on the right for. The one with "lala" in, right now. The most beautiful solution would be to load content from a different html source (to not clutter up the main html file too much) into that space when people click a link, of course, but I doubt that's possible?

http://www.student.ljmu.ac.uk/eclchaeb/rocks/rocksv3/
A not quite as elegant alternative would be to have all the divs inside the text and hiding/showing them on a click. However that'd need some expanding of the javascript I have and I am not that great at coding jscript, as is obvious from that rocksv3 example. Currently it just simply hides/shows the div it is assigned to. I guess it'd need a second variable to feed it all the divs it should change to display: none before displaying the new one.

Code:
function showhide(divId) {
  var div = document.getElementById(divId);
  div.style.display = (div.style.display=="block" ? "none" : "block");
}
The last alternative is, of course, to scrap the whole idea of displaying the more detailed explanations on the right and stick with the "expand text", even if that will push it apart a lot. I am not quite ready to give up yet, however.

Thanks for any answer - or just reading at all,
-Mnemon
Mnemon is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 03-20-2007, 08:48 PM Re: Displaying/Changing content of a div ... a question of possibility.
LadynRed's Avatar
Super Moderator

Posts: 6,339
Location: Tennessee
Quote:
The most beautiful solution would be to load content from a different html source (to not clutter up the main html file too much) into that space when people click a link, of course, but I doubt that's possible?
Actually, it is, and can be done without frames.
http://www.aplus.co.yu/web-dev/inser...her-html-page/

Quote:
A not quite as elegant alternative would be to have all the divs inside the text and hiding/showing them on a click.
Also possible with a bit of Ajax.
http://jquery.com/demo/thickbox/

ThickBox could work for your first problem too.
http://ajaxian.com/archives/thickbox...-with-any-html
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-21-2007, 11:16 AM Re: Displaying/Changing content of a div ... a question of possibility.
Novice Talker

Posts: 7
Thanks a lot for the answer.

Thought the first solution was a little too clumsy, and the thickbox seemed a little like overkill (and slow) ... but it made me dig on and search. Found a solution on dynamicdrive, in then end:
http://www.dynamicdrive.com/dynamici...jaxcontent.htm

http://www.student.ljmu.ac.uk/eclchaeb/rocks/rocksv4/

Now I have a bit more then a week to add content and do some small design fixes

Thanks again.

-Mnemon
Mnemon is offline
Reply With Quote
View Public Profile
 
Old 03-21-2007, 11:39 AM Re: Displaying/Changing content of a div ... a question of possibility.
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Be careful with this, Mnemon. Not everyone has Javascript enabled, and when you're dealing with institutes of higher learning, the so-called "educated" types will often disable JS in their newest version of Firefox (again, to show how smart they are...it's amazing how a web browser has slowly become an intellectual status symbol) and thereby screw up whatever you've built.

Make sure you have a non-JS alternative.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 03-21-2007, 02:50 PM Re: Displaying/Changing content of a div ... a question of possibility.
Novice Talker

Posts: 7
Yes, I know.

To be honest if this would be a big public webpage I'd make sure to keep JScript to a minimum. I do know that the prof using this is an Internet Explorer user and has JScript enabled, so I am fine on that end, for now. Outdoor Ed instructors are probably not your run of the mill academic type, luckily .

Thanks for the reminder, though, quite appreciated. If I have some time left before the deadline I might add some alternatives to display all the content without jscript, but it's not a must right now.

Cheers,
-Mnemon

Last edited by Mnemon : 03-21-2007 at 02:51 PM.
Mnemon is offline
Reply With Quote
View Public Profile
 
Old 03-21-2007, 03:04 PM Re: Displaying/Changing content of a div ... a question of possibility.
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Well at least seem to you know your target audience. That's more than 99.9% of designers off the top. Good on ya.

Probably right about the Outdoor Ed instructors (is that like an outdoor version of Physical Education?)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 03-21-2007, 03:20 PM Re: Displaying/Changing content of a div ... a question of possibility.
Novice Talker

Posts: 7
Quote:
Originally Posted by ADAM Web Design View Post
Probably right about the Outdoor Ed instructors (is that like an outdoor version of Physical Education?)
Depends which way you go. The Idea in general is to take people out and teach them about the world around them in that environment ... if that is adventure education or more traditional stuff like teaching geology/history/literature somewhere outside the class room is open.

Involves a lot of rock climbing and white water kayaking - probably one of the few degree programs that force one to sign a paper during registration to make sure that one (or one's family) won't hold the university responsible if one gets injured or dies during one of the lectures .

-Mnemon
Mnemon is offline
Reply With Quote
View Public Profile
 
Old 03-22-2007, 04:19 AM Re: Displaying/Changing content of a div ... a question of possibility.
chrishirst's Avatar
Super Moderator

Posts: 12,592
Location: Blackpool. UK
Quote:
If I have some time left before the deadline I might add some alternatives to display all the content without jscript
The simple way to acomplish this (no extra work involved), is to have all the content rendered visible initially. Then have a script after </body> that hides all the elements as needed.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Displaying/Changing content of a div ... a question of possibility.
 

Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15362 seconds with 13 queries