View Full Version : Simple Show/hide script
Wisdom
12-22-2010, 11:38 AM
There was a simple show/hide script here at dynamicdrive that does not require to upload .js files or such..
Just to click on some text/link to show and hide the content (first hidden)
I searched, and I searched and I searched ... but I cant find it any more :(
Can anyone give me a link to it please ?
vwphillips
12-22-2010, 02:42 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.resource {
position: absolute;
margin-left: 400px;
margin-top: -10px;
width: 300px;
height: 300px;
padding-bottom: 120px;
background-Color:#FFFFCC;
}
/*]]>*/
</style></head>
<body>
<div id="resourceLinks">
<a href="#" name="resource" rel="resource1">General Information</a><br />
<a href="#" name="resource" rel="resource2">Automatic 401(k)</a><br />
<a href="#" name="resource" rel="resource3">Consumer Fraud</a><br />
<a href="#" name="resource" rel="resource4">Direct Deposit</a><br />
<a href="#" name="resource" rel="resource5">Diversity</a><br />
<a href="#" name="resource" rel="resource6">Women</a><br />
<a href="#" name="resource" rel="resource7">Young Adults (20s - 40s)</a>
</div>
<div id="resource1" class="resource">1</div>
<div id="resource2" class="resource">2</div>
<div id="resource3" class="resource">3</div>
<div id="resource4" class="resource">4</div>
<div id="resource5" class="resource">5</div>
<div id="resource6" class="resource">6</div>
<div id="resource7" class="resource">7</div>
<script type="text/javascript">
/*<![CDATA[*/
function ShowOne(o){
var obj=document.getElementById(o.ID);
var as=obj.getElementsByTagName('A');
this.lst=false;
for (var sobj,z0=0;z0<as.length;z0++){
sobj=document.getElementById(as[z0].rel);
if (sobj){
sobj.style.display='none';
this.addevt(as[z0],'click','Show',sobj);
if (!this.lst){
this.lst=sobj;
}
}
}
}
ShowOne.prototype={
Show:function(obj){
this.lst.style.display='none';
this.lst=obj;
this.lst.style.display='block';
return false;
},
addevt:function(o,t,f,p){
var oop=this;
if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](p);}, false);
else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](p); });
}
}
new ShowOne({
ID:'resourceLinks'
});
/*]]>*/
</script>
</body>
</html>
Wisdom
12-22-2010, 03:51 PM
Sorry thats not it.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.