Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Macnoviz

macrumors 65816
Original poster
Jan 10, 2006
1,059
0
Roeselare, Belgium
I can't seem to find a solution for this rather simple problem: I have a homepage with recent updates, but they are starting to grow to rather long page, and since I want people to occasionally look at the footer as well, I want to hide all entries except the latest.
Is there a method to show and hide text, withouth having to use 2 pages? It's all very low-tech (manual entries and such) but I think this shouldn't be so hard.
The end result should be something like the descriptions in YouTube (pressing (more) reveals the entire description withouth reloading anything)

The code for that showed something like hideInline, but I couldn't find this in the dreamweaver help files.

P.S. Yes, I am new in web development:eek:
 
Assuming your not using a language that allows for dynamic content since you said it's "lowtech" you could just comment out the text in the HTML page. Comments are ignored by the browser but remain in the document.

HTML:
<!-- Insert text to be commented -->
 
by lowtech I do indeed mean HTML+CSS (and javascript)

but I would like the users to be able to see the extra content, just not right away.
 
You'll have to do some Java to show and hide things. I understand what you are trying to do, I've done it before but it was doing ASP.net websites.
 
Is it something like this?

Code:
<script language="javascript">
function hideshow(layername) {
    if (document.getElementById(layername).style.display=="")
        document.getElementById(layername).style.display = "none";
    else
        document.getElementById(layername).style.display = "";
}
</script>
<div onClick="hideshow('hiddentext1')">Click on this text to hide/show layer 1</div>
<div id="hiddentext1">Layer 1 <br /> Blah Blah Blah so on and so forth</div>
<br />
<div><a href="javascript:hideshow('hiddentext2')">Click on this text to hide/show layer 2</a></div>
<div id="hiddentext2">Layer 2 <br /> Blah Blah Blah so on and so forth</div>

Cut and paste into a new html file to test
 
You'll need JavaScript, not Java, and it's pretty simple....

In the CSS, set the elements display attribute to none to make it hidden by default.

Code:
#someId { display: none; }

Then use JavaScript to show the text:
Code:
document.getElementById("someId").style.display = "block";
(if it's an inline element, use "inline" instead of block"

To re-hide the text:
Code:
document.getElementById("someId").style.display = "none";

Hope that helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.