navigation
paul
- javascript
sorry für den langen code:
ich weise allen DIVs ne onmouseover/out funktion zu:
for(var j=0;j<allNaviElements.length;j++){
allNaviElements[j].onmouseover = function(){
this.myID = "navi" + this.id.substring(4) + "Layer";
//alert(this.myID);
MM_showHideLayers(this.myID,'','show');
}
allNaviElements[j].onmouseout = function(){
//alert(this.myID);
MM_showHideLayers(this.myID,'','hide');
}
leider passiert onmouseout vom "parent" schneller bevor onmouseover vom child detektiert wird. daher verschwindet das ausgeklapte menü sofort wieder... ?-(
kann mich jemand in die richtige richtung stossen?
danke.
paul
alls:
<html>
<head>
<style type="text/css">
#navi0 {
position:absolute;
top:100px;
left:100px;
width:200px;
height:50px;
visibility:visible;
background-color: red;
layer-background-color: red;
border: none;
cursor: hand;
cursor: pointer;
}
#navi1 {
position:absolute;
top:160px;
left:100px;
width:200px;
height:50px;
visibility:visible;
background-color: red;
layer-background-color: red;
border: none;
cursor: hand;
cursor: pointer;
}
#navi0Layer{
background-color: #00CCFF;
width:200px;
position:absolute;
left: 300px;
top: 100px;
visibility: hidden;
}
#navi1Layer{
background-color: #00CCFF;
width:200px;
position:absolute;
left:300px;
top: 160px;
visibility: hidden;
}
</style>
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function tmt_findObj(n){
var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
}else{x=document.getElementById(n)}return x;
}
function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
v=(v=='show')?'visible':(v='hide')?'hidden':v;
if(obj)obj.style.visibility=v;}} else{
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }}
}
function dRef(num) {return (document.layers? document.layers[num] : (document.all? document.all[num] : document.getElementById(num)))}
function go() {
//if (document.layers) document.navi0.captureEvents(Event.CLICK);
dRef("navi0").onclick = function(e) {
alert(this.id);
if(document.layers)routeEvent(e);
}
}
function showHideLayers(){
allNaviElements = new Array();
var allDIVs = document.getElementsByTagName("div");
for(var i=0;i<allDIVs.length;i++){
if(allDIVs[i].id.indexOf('navi')!=-1){
allNaviElements.push(allDIVs[i]);
//alert(allNaviElements[i].id.substring(4));
}
}
for(var j=0;j<allNaviElements.length;j++){
allNaviElements[j].onmouseover = function(){
this.myID = "navi" + this.id.substring(4) + "Layer";
//alert(this.myID);
MM_showHideLayers(this.myID,'','show');
}
allNaviElements[j].onmouseout = function(){
//alert(this.myID);
MM_showHideLayers(this.myID,'','hide');
}
}
}
//-->
</script>
</head>
<body onLoad="showHideLayers();">
<div id="navi0"></div>
<div id="navi1"></div>
<div id="unterlagen" style="position:absolute; width:227px; height:81px; z-index:1; left: 400px; top: 334px; visibility: hidden"><IMG src="layer_lehrunterlagen.gif" width="227" height="81"></div>
<div id="navi0Layer">
<div class="subclink"></div>
<div class="subclink"><a href="#" target="_top">jshvdvasv</a></div>
</div>
<div id="navi1Layer">
<div class="subclink"></div>
<div class="subclink"><a href="#" target="_top">BlaBlaBla</a></div>
</div>
</body>
</html>
Hallo.
leider passiert onmouseout vom "parent" schneller bevor onmouseover vom child detektiert wird. daher verschwindet das ausgeklapte menü sofort wieder... ?-(
kann mich jemand in die richtige richtung stossen?
Du weißt, wie man einen zeitlichen Verzug realisiert? Dann baue ihn ein.
MfG, at
alles klar :)
Danke.
p.