Forum Moderators: open
I have a website that is basically written in HTML but the page extension is .asp. Now Im really not a techie but my home page reads like a sales copy, by that I mean long, long and longer.............
Now I want to implement this thing that allows someone to click the word more and instead of going to a new page it just drops down. Can someone give me a code to install on my webpage to create this drop down menu and really show me how to implement it.
<style type="text/css">
.hidden{display:none;}
</style>
<script type="text/javascript" src="openAreas.js"></script>
openAreas={
getRefresh:function(h){
return function(){
location.hash=h;
openAreas.init();
}
},
init:function(){
var ln=document.links;
for(var i=0;i<ln.length;i++){
var h=(ln[i].href)?ln[i].href.replace(/^.*?(#¦$)/,""):"";
if(!h){
continue;
}
var el=document.getElementById(h);
el=(el)?el:document.getElementsByName(h)[0];
if(!el){
continue;
}
if(("#"+h)===location.hash){
el.className=(el.className)?el.className.replace(/(^¦\s)hidden(\s¦$)/,"$1"):"";
continue;
}
if(el.className)
el.className+=" ";
el.className+="hidden";
openAreas.addEvent(ln[i],"click",openAreas.getRefresh(h));
}
},
addEvent:function(el,ev,fn){
if(el.addEventListener){
el.addEventListener(ev,fn,false);
}
else if(el.attachEvent){
el.attachEvent("on"+ev,fn);
}
else{
el["on"+ev]=fn;
}
}
}
openAreas.addEvent(window,"load",openAreas.init);
Usage:
<a href="#intro">Intro</a>
<div id="intro">Hey intro and stuff</div>
<a href="#contact">Contact</a>
<div id="contact">Personal info hear</div>
<a href="#foo">Foo And Bar</a>
<div id="foo">Foo And Bar are used when i cant think of things to say</div>
<a href="#about">About</a>
<div id="about">Hey About us and stuff</div>