/    Sign up×
Community /Pin to ProfileBookmark

minimize textbox

Hi,

I have some news box on my site (still developing). It must be possible to minimize each box. something like http:start.be

Does someone know how to start with this?

greetings
Koen

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 21.2005 — Here's a start:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Hide and Show</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
function hide(obj) {
if(obj) { // open or close one
var sibling=(obj.nextSibling.nodeType==3)? obj.nextSibling.nextSibling : obj.nextSibling; // Moz or IE
sibling.className=(sibling.className=='expanded')? 'collapsed' : 'expanded';
}
else { // close all
var aDD=document.getElementsByTagName('DD');
for (var i=0;i<aDD.length;i++) {
aDD[i].className='collapsed';
}
}
}
if(document.getElementById) {
window.onload=function() {
hide();
var aDT=document.getElementsByTagName('DT');
for (var i=0;i<aDT.length;i++) {
aDT[i].style.cursor=(document.nodeType)? 'pointer' : 'hand'; // DOM or IE5
if (aDT[i].addEventListener) {
aDT[i].addEventListener('click', function() { hide(this); }, false);
}
else {
aDT[i].onclick=function() {hide(this);}
}
}
};
}
</script>

<style type="text/css">
dl {width:10em;}
dt {
border:1px solid #f33;
background:#9cf;
color:#000;
}
dd {margin:0;
border:1px solid #f33;
background:#eee;
color:#f33;
}
li {line-height:1em;display:inline;}
a, .expanded {display:block;}
.collapsed {display:none;}
</style>

</head>
<body>

<dl>
<dt>section 1</dt>
<dd>
<ul>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
</ul>
</dd>
<dt>section 2</dt>
<dd>
<ul>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
</ul>
</dd>
<dt>section 3</dt>
<dd>
<ul>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
<li><a href="#">item</a></li>
</ul>
</dd>
</dl>

</body>
</html>
×

Success!

Help @keon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...