Jojoxx.net logotyp

 

 

Användare ikonAnvändare
Besökare just nu: 25
Snabblänkar ikonSnabblänkar
JavaScript-arkivet
Perl
FAQ

Sök på Jojoxx.net


Länkmeny 7

Exempel

Menu 1
Menu 2
Menu 3

Kod


<script type="text/javascript">
window.onload=function(){
	initmenu();
}
var currentMenu=false;
var menues=new Array('sub1','sub2','sub3');
function sw(mnu,mode){
	if(mode){
		if(currentMenu){
			if(currentMenu==mnu){changeStyle(mnu,'display','none');currentMenu=false;}else{changeStyle(currentMenu,'display','none');changeStyle(mnu,'display','block');currentMenu=mnu;}
		} else {
			changeStyle(mnu,'display','block');currentMenu=mnu;
		}
	} else if (document.getElementById) {
		document.getElementById(mnu).style.display=(document.getElementById(mnu).style.display=='block')?'none':'block';
	}
}
function changeStyle(Id,Property,Value){
	if (document.all){
		eval('document.all[Id].style.'+Property+'="'+Value+'"');
	} else if (document.layers){
		eval('document.layers[Id].'+Property+'="'+Value+'"');
	} else if (document.getElementById){
		eval('document.getElementById(Id).style.'+Property+'="'+Value+'"');
	}
}
function initmenu(){
	for(var n=0;n<menues.length;n++){
		changeStyle(menues[n],'display','none');
	}
}
</script>
<div onClick="sw('sub1');" style="width:100px;cursor:default;border:solid black 1 px;background-color:rgb(180,180,180);">Menu 1</div>
<div id="sub1" style="width:100px;border:solid black 1 px;background-color:rgb(220,220,220);"><a href="#">Val 1</a><br><a href="#">Val 2</a><br><a href="#">Val 3</a></div>
<div onClick="sw('sub2');" style="width:100px;cursor:default;border:solid black 1 px;background-color:rgb(180,180,180);">Menu 2</div>
<div id="sub2" style="width:100px;border:solid black 1 px;background-color:rgb(220,220,220);"><a href="#">Val 1</a><br><a href="#">Val 2</a><br><a href="#">Val 3</a></div>
<div onClick="sw('sub3');" style="width:100px;cursor:default;border:solid black 1 px;background-color:rgb(180,180,180);">Menu 3</div>
<div id="sub3" style="width:100px;border:solid black 1 px;background-color:rgb(220,220,220);"><a href="#">Val 1</a><br><a href="#">Val 2</a><br><a href="#">Val 3</a></div>


,