Webmaster / SEO07 Jul 2006 03:47 pm
How to create a DHTML expandable lists.
Try the following example:
CODE:
-
<html>
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<title></title>
-
</meta><meta name="description" content="">
-
</meta><meta name="keywords" content="">
-
-
<style>
-
.general {font-family:Verdana;font-size:11;color:white}
-
.span_general {font-family:Verdana;font-size:9;color:white;border-style:solid;border-color:white;border-width:1px 1px 1px 1px;text-align:center;width:16;height:15;cursor:hand}
-
</style>
-
-
<script>
-
-
function objectOver(x){
-
x.style.color="#9ff5ff";
-
}
-
-
function objectOut(x){
-
x.style.color="white";
-
}
-
-
function collapse(x){
-
var oTemp=eval("document.all.text_"+x);
-
var oClick=eval("document.all.click_"+x);
-
-
if(oTemp.style.display=="block"){
-
oTemp.style.display="none";
-
oClick.innerHTML="+";
-
}
-
else{
-
oTemp.style.display="block";
-
oClick.innerHTML="-";
-
}
-
}
-
</script>
-
-
</meta></head>
-
<body bgcolor=#224452>
-
-
<div id=click_1 class=span_general onclick=javascript:collapse('1') onmouseover=javascript:objectOver(this) onmouseout=javascript:objectOut(this) style="margin-left:100;position:relative;left:-25;top:14"> - </div>
-
-
<div style="margin-left:100;display:block" class=general>
-
Text 1 TITLE
-
</div><br />
-
<div id=text_1 style="margin-left:100" class=general>
-
text that is displayed under Text 1 TITLE<br />
-
another line of text here<br />
-
</div>
-
-
<div id=click_1_1 class=span_general onclick=javascript:collapse('1_1') onmouseover=javascript:objectOver(this) onmouseout=javascript:objectOut(this) style="margin-left:200;position:relative;left:-25;top:14"> - </div>
-
<div style="margin-left:200;display:block" class=general>
-
Text 1_1 TITLE
-
</div><br />
-
<div id=text_1_1 style="margin-left:200" class=general>
-
Text under Text 1_1 TITLE catagory<br />
-
</div>
-
-
-
<div id=click_1_2 class=span_general onclick=javascript:collapse('1_2') onmouseover=javascript:objectOver(this) onmouseout=javascript:objectOut(this) style="margin-left:200;position:relative;left:-25;top:14"> - </div>
-
<div style="margin-left:200;display:block" class=general>
-
Text 1_2 TITLE
-
</div><br />
-
<div id=text_1_2 style="margin-left:200" class=general>
-
This is a test of the emergency broadcasting system.<br />
-
</div>
-
-
<div id=click_1_2_1 class=span_general onclick=javascript:collapse('1_2_1') onmouseover=javascript:objectOver(this) onmouseout=javascript:objectOut(this) style="margin-left:300;position:relative;left:-25;top:14"> - </div>
-
<div style="margin-left:300;display:block" class=general>
-
Text 1_2_1 TITLE
-
</div><br />
-
<div id=text_1_2_1 style="margin-left:300;display:block" class=general>
-
If there were a real emergency and you thought someone would care this <br />
-
information would be classified and you wouldn't know anyhows<br />
-
</div>
-
<div id=click_1_3 class=span_general onclick=javascript:collapse('1_3') onmouseover=javascript:objectOver(this) onmouseout=javascript:objectOut(this) style="margin-left:200;position:relative;left:-25;top:14"> - </div>
-
<div style="margin-left:200;display:block" class=general>
-
Text 1_3 TITLE
-
</div><br />
-
<div id=text_1_3 style="margin-left:200" class=general>
-
Example for 1_3 text area...<br />
-
Notice in the code that the breaks all have a trailing slash....thus closing the br tag<br />
-
I'm trying to remember to use correct syntax before something breaks it.
-
</div>
-
-
</body>
-
</html>