Script überprüfen
Dave
- javascript
0 Götz
Hi, ich habe gestern von jemandem als Antwort auf meine FRage nach einem Script für Popup-Menus mit NS 4.x folgendes Script bekommen:
<HEAD> <TITLE>test</TITLE> <!--LINK rel="styleSheet" href="mnunn.css"-->
<SCRIPT LANGUAGE="javaScript"> <!--
if (document.layers) { document.writeln('<LINK rel=stylesheet href=mnunn.css>'); document.writeln('<SCRIPT language=javaScript src=mnunn.js></script>');
} //--> </SCRIPT>
</HEAD> <BODY>
<LAYER position="absolute" bgColor="#FFDE7B" top="6" width="40" height="19" left="10"> <DIV class="menueN" style="LEFT: 10px; BORDER-LEFT: #000000 1px solid; TOP: 6px; HEIGHT: 19px"> </DIV> </LAYER> <LAYER position="absolute" bgColor="#FFDE7B" top="6" width="80" height="19" left="550" style="FONT-SIZE: 8pt"> <DIV class="menueN" style="BORDER-RIGHT: #000000 1px solid; FONT-SIZE: 8pt; LEFT: 550px; BORDER-BOTTOM: #000000 1px solid; TOP: 6px; HEIGHT: 19px; TEXT-ALIGN: right"> <FONT SIZE="-2" face="Arial">(c) by M. Kößling</FONT> </DIV> </LAYER> <!--Menüs --> <LAYER id="lmnue01" class="LmenueN" position="absolute" bgColor="#FFDE7B" top="6" width="130" height="19" left="50" onmouseover="hovern(this,'show',45)" onmouseout="hovern(this,'hide',0)"> <DIV class="menueN" id="mnue01" style="LEFT: 50px; TOP: 6px" onmouseover="hovern(this,'menueH')" onmouseout="hovern(this,'menueN')"> <li style="LIST-STYLE-TYPE: none"> <A style="COLOR: #000000; TEXT-DECORATION: none" href="kontakt.htm" >Kontakt </A></li> </DIV> </LAYER> <LAYER id="lmnue02" class="LmenueN" position="absolute" bgColor="#FFDE7B" top="6" width="130" height="19" left="180" onmouseover="hovern(this,'show',105)" onmouseout="hovern(this,'hide',0)"> <DIV class="menueN" id="mnue02" style="LEFT: 180px; TOP: 6px" onmouseover="hovern(this,'menueH')" onmouseout="hovern(this,'menueN')"> <li style="LIST-STYLE-TYPE: none"> <A style="COLOR: #000000; TEXT-DECORATION: none" href="tipps.htm">Tipps & Tricks </A></li> </DIV></LAYER> <LAYER id="lmnue03" class="LmenueN" position="absolute" bgColor="#FFDE7B" top="6" width="130" height="19" left="310" onmouseover="hovern(this,'show',75)" onmouseout="hovern(this,'hide',0)"> <DIV class="menueN" id="mnue03" style="LEFT: 310px; TOP: 6px" onmouseover="hovern(this,'menueH')" onmouseout="hovern(this,'menueN')"> <li style="LIST-STYLE-TYPE: none"> <A style="COLOR: #000000; TEXT-DECORATION: none" href="veroeff.htm">Veröffentlichungen </A></li> </DIV> </LAYER> <LAYER id="lmnue04" class="LmenueN" position="absolute" bgColor="#FFDE7B" top="6" width="130" height="19" left="440" onmouseover="hovern(this,'show',30)" onmouseout="hovern(this,'hide'),0"> <DIV class="menueN" id="mnue04" style="LEFT: 440px; TOP: 6px" onmouseover="hovern(this,'menueH')" onmouseout="hovern(this,'menueN')"> <li style="LIST-STYLE-TYPE: none"> <A style="COLOR: #000000; TEXT-DECORATION: none" href="ainfos.htm" >Autoren-Infos </A></li> </DIV> </LAYER><!--Menülisten --> <LAYER id="ulmnue01" class="LumenueN" width="129" top="25" background="linie.gif" bgcolor="#AFB1CD" color="#000000" visibility="hidden" clip="0,0,129,45" onmouseover="hovern_um(this,'show')" onmouseout="hovern_um(this,'hide')" left="50" z-index="4"> <DIV id="umnue01" class="umenueN" style="LEFT: 50px; TOP: 25px" onmouseover="hovern_um(this,'umenueH')" onmouseout="hovern_um(this,'umenueN')"> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="impressum.htm" > <li style="LIST-STYLE-TYPE: none">Impressum</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="adresse.htm" > <li style="LIST-STYLE-TYPE: none">Anschrift</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="uebermich.htm" > <li style="LIST-STYLE-TYPE: none">Lebenslauf</A> </LI> </DIV> </LAYER> <LAYER id="ulmnue02" class="LumenueN" width="129" top="25" background="linie.gif" bgcolor="#AFB1CD" color="#000000" visibility="hidden" clip="0,0,129,105" onmouseover="hovern_um(this,'show')" onmouseout="hovern_um(this,'hide')" left="180" z-index="4"> <DIV id="umnue02" class="umenueN" style="LEFT: 180px; TOP: 25px" onmouseover="hovern_um(this,'umenueH')" onmouseout="hovern_um(this,'umenueN')"> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#01" > <li style="LIST-STYLE-TYPE: none">Tipp der Woche!</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#excel" > <li style="LIST-STYLE-TYPE: none">zu Excel</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#word" > <li style="LIST-STYLE-TYPE: none">zu Word</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#outlook" > <li style="LIST-STYLE-TYPE: none">zu Outlook</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#outlook"> <li style="LIST-STYLE-TYPE: none"> zu Internet & HTML</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#vba" > <li style="LIST-STYLE-TYPE: none">zu VBA</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="tipps.htm#sonstiges"> <li style="LIST-STYLE-TYPE: none"> sonstige</A></LI> </DIV> </LAYER> <LAYER id="ulmnue03" class="LumenueN" width="129" top="25" background="linie.gif" bgcolor="#AFB1CD" color="#000000" visibility="hidden" clip="0,0,129,75" onmouseover="hovern_um(this,'show')" onmouseout="hovern_um(this,'hide')" left="310" z-index="4"> <DIV id="umnue03" class="umenueN" style="LEFT: 310px; TOP: 25px" onmouseover="hovern_um(this,'umenueH')" onmouseout="hovern_um(this,'umenueN')"> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="buecher.htm" > <li style="LIST-STYLE-TYPE: none">Bücher</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="fzeitschr.htm"> <li style="LIST-STYLE-TYPE: none">Fachzeitschriften</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="loseblatt.htm"> <li style="LIST-STYLE-TYPE: none">Loseblattsamml.</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="downloads.htm"> <li style="LIST-STYLE-TYPE: none">Downloads</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="erata.htm" > <LI style="LIST-STYLE-TYPE: none">Erata</A> </LI> </DIV> </LAYER> <LAYER id="ulmnue04" class="LumenueN" width="129" top="25" background="linie.gif" bgcolor="#AFB1CD" color="#000000" visibility="hidden" clip="0,0,129,30" onmouseover="hovern_um(this,'show')" onmouseout="hovern_um(this,'hide')" left="440" z-index="4"> <DIV id="umnue04" class="umenueN" style="LEFT: 440px; TOP: 25px" onmouseover="hovern_um(this,'umenueH')" onmouseout="hovern_um(this,'umenueN')"> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="ainfos.htm" > <li style="LIST-STYLE-TYPE: none"> Informationen</A> <A class=liste01 onmouseover="hovern2(this,'liste02')" style="COLOR: #000000; TEXT-DECORATION: none" onmouseout="hovern2(this,'liste01')" href="aforum.htm"> <li style="LIST-STYLE-TYPE: none">Forum</A> </LI></DIV></LAYER> <Layer name="inhalt" position="absolute" top="30" left"10" z-index="1"> <DIV id="inhalt" style="position:absolute;top:30;left:10;z-index:-1;"> DIV></LAYER> </BODY> </HTML>
mnunn.js: function hovern2(elem,strFormat) { return; }
function hovern_um(elem,strFormat) { //alert(elem.name); //elem.visibility=strFormat; }
function hovern(elem,strFormat,lngUnten) { var elemName='u' + elem.name; var lngI; elem=document.layers[elemName]; elem.visibility=strFormat; if (strFormat=="show") { //aufklappen des Menüs elem.clip.bottom=0; for (lngI=0;lngI<=lngUnten;lngI++) { setTimeout("document.layers['"+elemName+ "'].clip.bottom=" + lngI,lngI+350); }
} }
und natürlich noch die css-datei, die spielt hier jedoch momentan keine Rolle.
Mein Problem: -Haufenweise javascript-errors (line 18; elem has no properties) -Die Untermenus klappen beim darüberfahren wieder zu, sie sollten jedoch noch anklickbar sein
Ich habe bereits gemerkt, dass sehr oft die Eigenschaft für strFormat aus der Script-Datei fehlt, wollte das Script jetzt aber nicht ganz kaputtmachen.
Wie gesagt: es muss erstmal nur unter Netscape 4.x funzen.
Danke für alle Antworten, da Dave
Hallo Dave!
Mein Problem: [...]
Dein Problem ist, daß Du vollständige Scripte, die du wohl nicht so ganz verstehst (nehm ich mal an, sonst könntest die Errors ja beseitigen), einfach so als Posting abschickst und erwartest, daß sich wohl irgendwer findet, der es für Dich debuggt.
(Nein, ich kann kein JS, aber soviel Code muß imho nicht ins Forum gepostet werden.)
MfG
Götz