Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving space 1

Status
Not open for further replies.

hugh999

MIS
Nov 29, 2001
129
IE
I am looking for a piece of script that will save space on a web page. I have a lot of info to display on the page, so i would like to dipsly a link (ie: paragraph titles) that when clicked on, the paragraph appears under the link and then dissapers once the linked is re-clicked
 
Try this
<script>
function togglePara(paraName) {
var para=document.getElementById(paraName)
if (para.style.display==&quot;none&quot;) {
para.style.display=&quot;&quot;
} else {
para.style.display=&quot;none&quot;
}
}
</script>
<body>
<span id=&quot;title1&quot; onClick=&quot;togglePara('para1')&quot;>Title1<span>
<span id=&quot;para1&quot; style=&quot;display:none&quot;>This is the main Text</span>
</body>

You don't have to use Spans - any inline or block element will do - the code can be generalised, but it's not really necessary

Hope this helps

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top